To answer my Q, used the construct -
selectable = lambda ids : verify_stud(ids) ,
and updated did the update in
verify_stud
So code looks like this -
form = SQLFORM.grid(query=query,create=False,searchable=False,
orderby=db.s_user.first_name,csv=False,
selectable = lambda ids : verify_user(ids) ,
details=False,deletable=False,fields=fields,headers=headers,editable=False)
def verify_user(ids):
print "Function verify called"
if not ids:
response.flash='Please Select the Check-box to verify'
else:
for row in ids:
print row
db(db.s_user.id == row).update(is_verified=1)
pass
pass
return ''
On Tuesday, April 22, 2014 10:28:27 AM UTC+5:30, Jayadevan M wrote:
>
> I am learning how to use SQLFORM.grid. I am able to display a set of
> records.
> 1) If the user clicks on Edit for a record, it goes to a new page and also
> displays all the columns (though I chose only a few fields in the grid).
> How can I avoid that?
> 2) Is it possible to update multiple records in the initial form that
> comes up? The form displays a list of users and their key attributes. The
> user just needs to check a verified flag against the users and click
> submit.
>
--
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 [email protected].
For more options, visit https://groups.google.com/d/optout.