On Wednesday, September 21, 2016 at 9:36:14 AM UTC-4, Scott Hunter wrote:
> Here's a simple controller using an SQLFORM.grid w/ selectable:
>     def open_requests():
>         print 'Req: %r' % request.vars
>         query = ...
>         form = SQLFORM.grid(query, csv=False, details=False, deletable=
> False, editable=False, searchable=False, create=False,
>             selectable = lambda ids : None)
>         return locals()
> This, as expected, puts a checkbox on each row.  If I select two rows and 
> hit Submit, I get the following printed from the server:
> Req: <Storage {'records': ['142', '196'], '_formkey': 
> '0720df2b-6449-43c8-a6b7-6c89dfdebcd3', '_signature': 
> 'cbc73b5fbdc8e5961830efbe3f672f35a41d6771', '_formname': 'web2py_grid'}>
> Req: <Storage {'_signature': 'cbc73b5fbdc8e5961830efbe3f672f35a41d6771'}>
> The section of the online book about this says the lambda in the 
> selectable should be a redirect; when it was, I still got 2 requests, but 
> the second had an added var w/ the selected IDs.

The book doesn't say the callback should do a redirect -- that's just an 
example. In any case, if your callback doesn't do a redirect, then the grid 
code itself will do a redirect back to the original URL. This is by design 
(maybe so reloading the page or leaving and returning don't trigger a 
browser warning and subsequent re-posting of the selected rows).


- 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