I'm now using the .represent property for the table field.

In my model, I added:

db.t_child.f_parent.represent = \
        lambda value, row: A(row.f_parent.f_name, 
_href=URL('parent_manage', args=['t_parent', 'view', 't_parent', 
row.f_parent.id], user_signature=True))

Now, all my child items contain a link to their parent item and all the 
grids don't require another button.

On Saturday, January 26, 2013 8:54:31 AM UTC-5, Michael Beller wrote:
>
> I understand (I think) how to create and manage the button links within a 
> smart grid but I'd like to make the reference field value a link to it's 
> associated record.
>
> For example ...
>
> # parent table
> db.define_table('t_parent', Field('f_name'))
>
> # child table
> db.define_table('t_child', Field('f_name'), Field('f_parent', 
> type='reference t_parent'))
>
> Smartgrid for child table would show f_name, f_parent.  What is the best 
> way to make the f_parent value in the grid a link to view the parent 
> record?  The link could be to the action/function for the smartgrid 
> associated with the t_parent table (with args to view record).
>
> Thanks in advance.
>

-- 

--- 
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 [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to