Jim Thanks, Your suggestion worked. It would be nice if one does not have to duplicate the code, any idea how parent can inherit child's behavior?
W On Thursday, February 21, 2013 6:32:58 PM UTC-5, Jim S wrote: > > Try moving your > > db.person.url.represent = lambda url, row: A(url,_href=url) > > into your list_organizations method. I don't believe your list_people > method isn't utilized in the screen shots provided. > > -Jim > > > On Thursday, February 21, 2013 5:23:27 PM UTC-6, wwwgong wrote: >> >> using web2py v2.3.2, I found smartgrid shows inconsistent behavior >> between parent and child tables. >> >> To illustrate, >> >> #model: parent: org, child: person >> db.define_table('organization', >> Field('name'), >> Field('url',label='URL') >> ) >> >> db.define_table('person', >> Field('name'), >> Field('url',label='URL'), >> Field('organization','reference organization'), >> ) >> >> #controller: both tables have a URL field >> def list_organizations(): >> db.organization.url.represent = lambda url, row: A(url,_href=url) >> form = SQLFORM.smartgrid(db.organization) >> return dict(form=form) >> >> def list_persons(): >> db.person.url.represent = lambda url, row: A(url,_href=url) >> form = SQLFORM.smartgrid(db.person) >> return dict(form=form) >> >> Issue: >> field organization.url shows hyperlink, but field person.url does not. >> >> see attached screenshot >> >> I start to read web2py source code, and can help with some guidance. >> >> Thanks, >> Wen >> > -- --- 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.