On Dec 6, 7:47 am, Paul Johnston <[EMAIL PROTECTED]> wrote:
> >I have a table of data, where I want the end user to be able to edit a
> >field in a particular one of the columns. A good example would be a
> >shopping cart with a quantity field for each item in the cart.
>
> One approach is to build the whole table as widgets. Create a widget,
> say LabelWidget, that does static text, and create TableGrid (probably
> derived from RepeatingFieldSet) that does the rows. In this arrangement
> validation will work fine with a variable number of rows.

How does one create Widgets? This doesn't seem to be documented.
Perhaps it's in The Book (I don't have it with me, and can't check).

I'm a total novice at using Widgets in this way so pretty much
everything you just said sounds like magic. I'm not at all sure how
I'd do any of that. To be honest I'm got no problem creating the table
or validating the data (which I'll do manually), just the idea of
knowing how to generate unique inputs, and how to recognise them when
they're submitted.

> But that's a bit of a pain - I expect you just want to build your table
> in the template, and insert the widgets as appropriate. I have done this
> successfully by pre-rendering each widget to text, and inserting the
> text.

I think I'd be more inclined just to create an extra widget instance
for each row, and send that down with the list of data. Is there a
reason why I shouldn't do that?

Surely there's more than 1 or 2 people who've implemented shopping
carts or the like? :)

--
Ben Sizer

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"TurboGears" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/turbogears?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to