In the end I have used a different slightly more messy approach. I am 
getting the record id from the args by using a conditional to test if it is 
in one of 2 possible positions.

@auth.requires_login()
def contact_manage():
    form = 
SQLFORM.smartgrid(db.t_contact,linked_tables=['t_courses','t_membership','t_paypal'],
 
onupdate=auth.archive, formname="Contact Manager")
    if request.args(2) == 't_contact':
        memberId = request.args(3)
    else:
        memberId = request.args(2)
    
    return locals()

I looked into fetching it using similar code to your link function but it 
seems you can only request the id of the current record using 
db.t_contact.id from within the parameters of your SQLFORM.smartgrid 
request.

Its a dirty hack but it seems to work.

Mike

On Tuesday, 20 November 2012 07:15:22 UTC, Johann Spies wrote:
>
> On 19 November 2012 14:58, Michael Hall <pix...@gmail.com <javascript:>>wrote:
>
>> Hi Villas
>>
>> I like the idea of using a var instead of args but I am still uncertain 
>> of how I get the ID of the current record I am viewing/editing in smartgrid.
>>
>>
> Here is an example of code I am using where 'auid' represents the id of 
> the author record:
>
>   links = [lambda row: (A(B(T('Edit')), _target = "_blank",
>                             _href = URL(r = request,
>                                         c = 'authors',
>                                         f = 'edit_author',
>                                         vars = dict(auid = str(row[
> db.akb_authors.id])))))]
> query = ...
> fields = [list of fields]
>
> I then call the grid with SQLFORM.grid(query, fields=fields, links=links)
>
>
> Regards
> Johann
> -- 
> Because experiencing your loyal love is better than life itself, 
> my lips will praise you.  (Psalm 63:3)
>
>

-- 



Reply via email to