I see. Thank you.

I also did some Googling and found what I think should be documented more
explicitly and perhaps more clearly in web2py docs (it's there, but unless
you know what to look for, you're guaranteed to miss it):

when creating grid, the following
   args=request.args[:1]
tells the grid to keep the arguments in place and reload on top of existing
one(s) - this seems to be a perfect solution by design!

On Fri, Apr 24, 2020 at 1:18 PM Jim S <ato.st...@gmail.com> wrote:

> So, you have to manage that yourself.
>
> I do it kind of like this.  Yes, I know it's ugly but it pretty much works.
>
> #  if the variable is passed in, get the value
> search_text = request.get_vars.search_text
>
> if request.wsgi.environ['QUERY_STRING'] != '':
>     #  we get here if no vars were passed on the request - in
>     #  this case, I want to see if I've saved a copy of them to session
>     #  and if so, grab them and use them
>     if not search_text:
>         try:
>             search_text = session['search_values']['search_text']
>         except:
>             search_text = ''
>
> #  now I use search text to build the query I'm going to pass to
> SQLFORM.grid
>
> #  store the current value of the variables back to your session
> session.search_values = dict(search_text=search_text)
>
> Not pretty, but it works for my use case.
>
> -Jim
>
>
>
>
> On Friday, April 24, 2020 at 11:58:23 AM UTC-5, Vlad wrote:
>>
>> Yes, there are arguments on the page already. I don't want the grid to
>> get rid of them when reloading for those actions.
>>
>> On Fri, Apr 24, 2020, 12:39 PM Jim S <ato....@gmail.com> wrote:
>>
>>> I thought it did keep track of paging.
>>>
>>> Are you looking for it to keep arguments that you supplied?
>>>
>>> -Jim
>>>
>>> On Friday, April 24, 2020 at 11:33:47 AM UTC-5, Vlad wrote:
>>>>
>>>> I've got a page with a grid on it.
>>>> grid reloads the page on create and other actions.
>>>> the page to begin with has arguments, for example, page/1/2/3.
>>>> I want the grid to keep these 1/2/3 in place when reloading the page on
>>>> those actions, for example, on new record it should use page/1/2/3/new
>>>> instead of page/new.
>>>> How do I achieve it? There must be a parameter that enables grid to
>>>> keep the args, but I can't find it -
>>>>
>>> --
>>> 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 a topic in the
>>> Google Groups "web2py-users" group.
>>> To unsubscribe from this topic, visit
>>> https://groups.google.com/d/topic/web2py/llt-aRxLeBo/unsubscribe.
>>> To unsubscribe from this group and all its topics, send an email to
>>> web...@googlegroups.com.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/web2py/6638c197-7342-4e11-8b86-8b4606f1847a%40googlegroups.com
>>> <https://groups.google.com/d/msgid/web2py/6638c197-7342-4e11-8b86-8b4606f1847a%40googlegroups.com?utm_medium=email&utm_source=footer>
>>> .
>>>
>> --
> 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 a topic in the
> Google Groups "web2py-users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/web2py/llt-aRxLeBo/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> web2py+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/web2py/3f80cee5-4f2d-44f5-95bb-458bcfd52c93%40googlegroups.com
> <https://groups.google.com/d/msgid/web2py/3f80cee5-4f2d-44f5-95bb-458bcfd52c93%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/CABZ%2BKCDBsFgvHP1w-1-N8-hUx7MLS7B4hRJwP-gxkEzjr0qtag%40mail.gmail.com.

Reply via email to