Here's a code example : db definition: db.define_table('person', Field('name'), format='%(name)s') db.define_table('thing', Field('name'), Field('owner_id','reference person'), format='%(name)s')
controller: def manage_test(): db.thing.owner_id.represent=lambda id, row: '%s' % db.person[row.owner_id].name.upper() grid=SQLFORM.smartgrid(db.thing) return dict(grid=grid) db.thing.owner_id.represent is not taken into account when click on add or edit button. Many thanks! On Friday, September 27, 2013 10:47:38 AM UTC+2, Mirko wrote: > > Hi, > > I'm using 2.5.1 and I defined a table with a default format which I > override in my controller with "represent" attribute and then I call > smartgrid on another table referencing the first one. > > When I call the controller, smartgrid shows a tabular display and the > representation I overrode is taken into account, the correct string > representation is displayed, fine. > > But when I click on add button or edit button, it appears that the default > format is used for the dropdown list. > > I've tried many workarounds unsuccessfully, but I'm sure the new > representation code line is executed and it looks like on creation or > editing smartgrid is reloading the table definition after that... > > Or I'm I missing something ? > > Thanks in advance! > > Mirko > -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.