[web2py] Re: How to add à link with arguments in SQLFORM.grid

2015-12-02 Thread Anthony
On Wednesday, December 2, 2015 at 6:55:22 AM UTC-5, Adrien wrote:
>
> links = [dict(header='', body=lambda row : A(db.generalfix.IdGene, 
> _class='btn', _href=URL(c='show', f='show', vars = 
> dict(id=db.generalfix.IdGene]
>

Note, your lambda has a "row" argument, so that is what you use to access 
the field values of each record passed to the lambda:

A(row.generalfix.IdGene, _class='btn',
  _href=URL(c='show', f='show', vars = dict(id=row.generalfix.IdGene

db.generalfix.IdGene is the Field object used to define the database table 
-- it does not represent an actual value from a specific record.

Anthony

-- 
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/d/optout.


[web2py] Re: How to add à link with arguments in SQLFORM.grid

2015-12-02 Thread Adrien
Okay, it works !
 I understand now, thx Anthony !

Le mercredi 2 décembre 2015 14:46:26 UTC+1, Anthony a écrit :
>
> On Wednesday, December 2, 2015 at 6:55:22 AM UTC-5, Adrien wrote:
>>
>> links = [dict(header='', body=lambda row : A(db.generalfix.IdGene, 
>> _class='btn', _href=URL(c='show', f='show', vars = 
>> dict(id=db.generalfix.IdGene]
>>
>
> Note, your lambda has a "row" argument, so that is what you use to access 
> the field values of each record passed to the lambda:
>
> A(row.generalfix.IdGene, _class='btn',
>   _href=URL(c='show', f='show', vars = dict(id=row.generalfix.IdGene
>
> db.generalfix.IdGene is the Field object used to define the database table 
> -- it does not represent an actual value from a specific record.
>
> Anthony
>
>

-- 
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/d/optout.