z3c.form.Datagridfield. Widgets and setting

Maybe also interesting for the DGF implementers:

I've started to enhance the demo module to share some examples with behaviors and contenttypes. See Vocabulary lookup fix in `++add++` forms by petschki · Pull Request #187 · collective/collective.z3cform.datagridfield · GitHub (which originally only wanted to fix the vocabulary lookup on ++add++ forms)

Starting to create an example with a XML file as schema I notized, that the ExportImportWidgetHandler for plone.autoform is missing completely, so that's been added here: Fix missing `plone.autoform` ExportImportHandler by petschki · Pull Request #188 · collective/collective.z3cform.datagridfield · GitHub

Now you can customize the DGF widget attributes like this:

<?xml version="1.0" encoding="utf-8"?>
<model xmlns="http://namespaces.plone.org/supermodel/schema"
       xmlns:form="http://namespaces.plone.org/supermodel/form"
       xmlns:i18n="http://xml.zope.org/namespaces/i18n"
       xmlns:security="http://namespaces.plone.org/supermodel/security"
       i18n:domain="collective.z3cform.datagridfield"
>
  <schema>
    <field name="table"
           type="zope.schema.List"
    >
      <title>Tabular Field</title>
      <description />
      <value_type type="collective.z3cform.datagridfield.row.DictRow">
        <schema>collective.z3cform.datagridfield.demo.interfaces.ITableRow</schema>
      </value_type>
      <form:widget type="collective.z3cform.datagridfield.datagridfield.DataGridFieldWidgetFactory">
        <allow_reorder>True</allow_reorder>
        <auto_append>False</auto_append>
      </form:widget>
    </field>
  </schema>
</model>
3 Likes