SmokeyD schrieb:
> Hey people,
> 
> I have a suggestion for the attrwrapper class of
> turbogers.widgets.DataGrid.Column.
> At the moment it is impossible to define a method as the value getter
> of the value of a cell in the DataGrid.
> It is possible to use DataGrid(fields=[('Name','name')]) but not
> DataGrid(fields=[('Name','getname()')]) or something similar. I

I'm doing that all the time - or do I fundamentally misunderstand you here?

     def edit_teaser(teaser):
         return XML("""<a href="edit_teaser?id=%(id)i">edit</a> <a 
href="delete_teaser?id=%(id)i">delete</a> """ % dict(id=teaser.id))


     teaser_grid = datagrid.DataGrid(fields=[('Title', 'title'),
                                             ("Image", lambda t: 
XML("""<a href="teaser_image?id=%i">Yes</a>"""  % t.id) if t.image is 
not None else "No"),
                                         ('Actions', edit_teaser)])


As you can see, I pass a callable, which in turn gets the row-object passed.

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
-~----------~----~----~----~------~----~------~--~---

Reply via email to