Even if we were to add ability in grid to take vars as params - it may not
be useful in my case (I think) because when controller is invoked for
view/search/pagination, "original" request.vars are lost (that is why
saving in session is needed)

-Mandar

On Wed, Oct 24, 2012 at 3:26 PM, Niphlod <niph...@gmail.com> wrote:

> isn't this a little silly ? we have an args parameter to the grid but not
> a vars one....
>
> Could you try to test a little mod to the source.....
>
> - open gluon/sqlhtml.py and scroll until "def grid("
> - add a vars={} default parameter
> - a few line below, there's "def url(**b)"
> - change with this
>
>     def url(**b):
>             b['args'] = args + b.get('args', [])
>             vars.update(b.get('vars', {}))
>             b['vars'] = vars
>             b['hash_vars'] = False
>             b['user_signature'] = user_signature
>             return URL(**b)
>
>
> Create a grid with
> grid = SQLFORM.grid(table, vars=dict(mycustomvar='mycustomvalue'))
>
> In theory, the 'mycustomvar' parameter should be passed along with
> navigation into the grid without causing problems.
>
> Disclaimer: use customized vars, not the ones the grid uses (like order,
> keywords, search,page, etcetc). Should be safe though, in case of collision
> the grid wins over the vars you passed on instantiation.
>
>
> On Wednesday, October 24, 2012 8:40:57 AM UTC+2, lyn2py wrote:
>>
>> When/where should I "clean" these variables from session ?
>>> In case user directly accesses second URL (without going thru first URL
>>> to select the search criteria) they might see incorrect results - since
>>> controller function will use "old" values
>>>
>>
>> I suggest to ensure that URLs must be followed. Not possible to clear the
>> session vars especially if search result has more than one page. Use
>> user_signature=True for your SQLFORM.grid
>>
>  --
>
>
>
>

-- 



Reply via email to