Anthony has created a working example. That and his analysis is listed below:
Massimo's solution will work if the query involves only the TaxonomyDetail table, but your grid involves a join, so it is necessary to include the tablename (i.e., record.TaxonomyDetail.objectID). But then that will fail if you do show a grid with only the TaxonomyDetail table. In any case, it is not necessary to bother with record.objectID, because that is simply the value of the current field, so you can use the first argument passed to the lambda (i.e., "id"). But there are two other problems with the above -- the link will show only the ID, not the objectDisplayName; and the URL() function is incorrect. Here's what you want: db.TaxonomyDetail.objectID.represent = lambda id, r: A(db.ObjectSuperType(id).objectDisplayName, _href=URL('manage_object_super_type', vars=dict(filter=id))) Notice in the URL, I put the record id in a query string variable (which I called "filter", though any name will do). That is because passing URL args to the grid can get tricky -- you have to tell the grid which args in the URL are part of the base URL (so it can figure out which ones are for the grid). However, that means you must always know which args are part of the base URL. But if in some cases you add an arg and some cases you do not, then it is difficult to distinguish between those cases. My solution is to use a var instead of an arg so there is no confusion. Here is what the manage_object_super_type() function should look like: def manage_object_super_type(): constraints = None if request.vars.filter: constraints = dict(ObjectSuperType=db.ObjectSuperType.id<http://db.objectsupertype.id/> == int(request.vars.filter)) grid = SQLFORM.smartgrid(db.ObjectSuperType, constraints=constraints), return dict(grid=grid) Anthony On Tuesday, August 6, 2013 12:17:03 AM UTC-7, Johann Spies wrote: > > if you use Massimo's suggested code: > > db.TaxonomyDetail.objectID.represent = lambda id, record:A(record. > objectID, _target = "_blank", _href = URL('manage_object_super_type',id)) > > Then in ' manage_object_super_type' do something like this: > > > > def manage_object_super_type(): ## > data = crud.read(db.ObjectSuperType.id ==request.args(0)) > #grid = SQLFORM.smartgrid(db.ObjectSuperType), > #return dict(grid=grid) > return(dict(grid=data) > > Regards > Johann > > -- > Because experiencing your loyal love is better than life itself, > my lips will praise you. (Psalm 63:3) > -- --- 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.