[Product-Developers] Create a datagrid like interface using zope schema

David Bain david.bain at alteroo.com
Wed Jul 2 20:02:27 UTC 2008


Martin,
What you've described assumes a lot of knowledge about formlib and z3. I'm
sure it is very doable, for now, due to time, I'm going to go with a
TextLine and require users to enter data in the form category|tag1, tag2,
tag3

 :).

Thanks again, hopefully I'll revisit this another time.

On Wed, Jul 2, 2008 at 1:34 PM, Martin Aspeli <optilude at gmx.net> wrote:

>
>
> David Bain-5 wrote:
> >
> > Sorry... I know how annoying poorly asked questions are. I usually try to
> > take time to formulate my questions.
> > Spent too much time explaining :) and not enough time asking.
> >
> > right .. so the question:
> >
> > Anyone know how to implement something like a datagridwidget using
> > zope.formlib?
> >
>
> Formlib widgets are not too hard to write. Look at the wysiwygwidget in
> plone.app.form, for example. It's just a class + a template.
>
> I'd probably start off by making a custom field type, deriving from
> zope.schema.List. Make it take a list of column definitions as a parameter.
> A Column definition can just be a zope.schema field again, e.g.
>
> class IFoo(Interface):
>
>    field = GridField(title=u"My grid", columns=[TextLine(title=u"Name"),
> Int(title=u"Age")])
>
> This should be enough to render the grid. The actual storage should be a
> list of lists, obviously. The field will need to do some validation and
> marshalling, but that's pretty simple. Look at zope.schema.List and its
> bases.
>
> The widget should probably just look up an IInputWidget for each field and
> render that on each cell. Rendering a widget is pretty easy - you adapt
> field + request to IInputWidget and call the result, I think.
>
> You'll need to ensure that you get an appropraite set of :list or :records
> type form variables. The widget then has a marshaller that looks at the
> request and extracts the relevant information, turning it into a list of
> lists for the field to consume. You can probably steal a lot of this from
> DataGridField in any case.
>
> One interesting option may be to try to use subforms for this, although if
> you want JS operations to add rows, re-order and so on, it may be more
> trouble than it's worth.
>
> Martin
> --
> View this message in context:
> http://www.nabble.com/-Product-Developers--Create-a-datagrid-like-interface-using-zope-schema-tp18241208s20094p18243962.html
> Sent from the Product Developers mailing list archive at Nabble.com.
>
>
> _______________________________________________
> Product-Developers mailing list
> Product-Developers at lists.plone.org
> http://lists.plone.org/mailman/listinfo/product-developers
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.plone.org/pipermail/plone-product-developers/attachments/20080702/870f6786/attachment-0001.html>


More information about the Product-Developers mailing list