chiangf schrieb:
> I've been playing with widgets and I can't quite figure out how to pass
> parameters to a widget class... this is what I have:
>
> class MyFields(widgets.WidgetsList):
> field = widgets.SingleSelectField(label="My Field Label",
> options=[(table.id, table.name) for table in
> MyDBTable.select()])
>
> MyDBTable obviously has 2 columns, id and name
>
> If I wanted to pass MyFields some information (e.g. the label
> "MyField"), how should I do it?
>
> Basically, I want to be able to alter the instance, something like:
> myfield = MyFields("New Label Name")
You can pass a dictionary of parameters when rendering the widget. Like
this:
${widget.display(value, {'name': 'My Label Nam'})}
does that help you?
diez
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---