Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Extending vangheem's answer: You can provide support for collective.z3cform.datagridfield by providing a field factory, but it will be a hack.</p> <p>Reason being is, that the <code>collective.z3cform.datagridfield.row.DictRow</code> expects a schema, defining the table rows. This becomes a subform once rendered. The schemaeditor in this instance would need to ask you depending on the field type also for the (table-) schema.</p> <p>Depending on what solution you are after, you might be able to get away by implementing a field factory with a <strong>fixed table schema</strong> like this:</p> <pre><code>from five import grok from zope import schema import collective.z3cform.datagridfield.row import plone.schemaeditor.interfaces import zope.interface # example from http://pypi.python.org/pypi/collective.z3cform.datagridfield class ITableRowSchema(zope.interface.Interface): one = schema.TextLine(title=u"One") two = schema.TextLine(title=u"Two") three = schema.TextLine(title=u"Three") # new field factory for the zope.schema.interfaces.IObject class DataGridFieldFactory(grok.GlobalUtility): grok.provides(plone.schemaeditor.interfaces.IFieldFactory) # this will show up in the schema editor vocabulary title = "DataGridField" def __call__(self, *args, **kwargs): # that's the horrid part as it will nail your field to this # specific schema kw = dict(value_type=collective.z3cform.datagridfield.row.DictRow( schema=ITableRowSchema)) kwargs.update(kw) return zope.schema.List(*args, **kwargs) </code></pre> <p>Please have a look into: <code>plone.schemaeditor.fields.py</code> for more information about the field factory.</p> <p>This will get you a basic datagrid for your content type. What's missing is the widget, which you currently can't be declared AFAIK.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload