I got it,
finally,
It was purely mystical for me, but now it makes sense... Grid is quite a
sophisticated beast and does some magic behind the stage...

Thank you very much!



On Thu, Dec 27, 2018 at 11:08 PM Anthony <[email protected]> wrote:

> This simply displays an old fashioned grid. Nothing fancy. But now
>> consider just exactly same code, with 2 extra lines (if (id==0):
>> redirect(home) :
>>
>> def test():
>>     id = 0
>>     try:
>>         id = request.args(0, cast=int)
>>     except:
>>         id = 0
>>         pass
>>     if (id==0):
>>         redirect('home')
>>     grid = SQLFORM.grid(db.test_table, user_signature=False)
>>     return locals()
>>
>> Now, this looks exactly like the previous one - but this grid is NOT
>> functional. Neither create nor delete work! The buttons are there, but the
>> create and delete functions do NOT perform.
>>
>> Please note that I always specify the parameters - app/default/test/1
>>  or app/default/test/100 - it's never called without a parameter. So
>> logically, unless I am missing something, if (id==0) should never be the
>> case - right?
>>
>
> As mentioned earlier, if you want to use some URL args in your code that
> should not apply to the grid, you must make this explicit by passing args
> that must be preserved by the grid via its "args" argument. See
> http://web2py.com/books/default/chapter/29/07/forms-and-validators#Using-requests-args-safely.
> This tells the grid to preserve the URL args you are using in any URLs it
> creates, and to ignore those args internally.
>
> 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 [email protected].
> For more options, visit https://groups.google.com/d/optout.
>

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

Reply via email to