The field callback actually receives the entire row (the obj parameter you see in the lambda) so you can return your content making decisions related to any field of the row.
On Wed, Oct 31, 2012 at 10:11 PM, RyanWilson <[email protected]> wrote: > Hi, > > This is a great tutorial: > http://www.turbogears.org/2.2/docs/main/DataGrid/index.html?highlight=datagrid > > Can someone recommend a way to make to make the appearance 'Edit' button in > the Action column conditional on another field? > > My data table is totally different, so for example, I'd like the 'Edit' link > to only show when phone number start with '323' > > addressbook_grid = DataGrid(fields=[ > > SortableColumn('Name', 'name'), > > SortableColumn('Surname', 'surname'), > > SortableColumn('Phone', 'phone'), > > ('Action', lambda obj:genshi.Markup('<a href="%s">Edit</a>' % > url('/edit', params=dict(item_id=obj.uid)))) > > ]) > > > > -- > You received this message because you are subscribed to the Google Groups > "TurboGears" group. > To view this discussion on the web visit > https://groups.google.com/d/msg/turbogears/-/j-RfyOcCjCYJ. > 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. -- 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.

