The links argument must be a list of dict(header='name',body=lambda row: 
A(...)) where header is the header of the new column and body is a function 
that takes a row and returns a value. In the example, the value is a A(...) 
helper.
http://web2py.com/books/default/chapter/29/07/forms-and-validators#SQLFORM-grid-signature

On Saturday, April 2, 2016 at 9:10:02 PM UTC-4, Jeff Riley wrote:
>
> Hello all.  I have the following function to display a smartgrid.  My 
> issue is I am not able select a header to sort.  It gives me a 404.
>
> @auth.requires_login()
> def manage_sheets():
>     if 'new' in request.args:
>         redirect(URL('new_sheet', args=[session.cust_id]))
>     elif 'edit' in request.args:
>         redirect(URL('edit_sheet', args=[request.args(3)]))
>     elif 'view' in request.args:
>         redirect(URL('view_sheet', args=[request.args(3)]))
>     sheets = db.sheet.customer_id==request.args(0,cast=int)
>     this_customer = db.customer(db.customer.id==request.args(0,cast=int))
>     session.cust_id = this_customer.id
>     LINKS=[lambda row: A('Sheet 
> Archive',_href=URL('manage_sheet_archive',args=[row.id, 
> session.cust_id]))]
>     form = SQLFORM.smartgrid(db.sheet, constraints = dict(sheet = sheets),
>                              searchable=True, editable=True, 
> deletable=False,
>                              create=True, paginate=20, maxtextlength=60, 
> fields=[db.sheet.title,
>                              db.sheet.sheet_version, db.sheet.created_by, 
> db.sheet.created_on],
>                              orderby=db.sheet.title, links=LINKS, 
> linked_tables={})
>     return dict(form=form, customer=this_customer)
>

-- 
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.

Reply via email to