Re: [web2py] Re: In SQLFORM.grid, setting a session var when the user click on search or reset

2017-05-04 Thread Massimiliano
What about to use a custom button instead of the “view” one?

You can use the grid ’s links options to build you button.
and then you can use the A(…, callback=URL(…), target=yourdiv) to fill
yourdiv with your details

Take a look here
http://www.web2py.com/books/default/chapter/29/05/the-views#A


On Wed, May 3, 2017 at 10:03 PM, Dave S  wrote:

>
>
> On Wednesday, May 3, 2017 at 5:51:34 AM UTC-7, Gael Princivalle wrote:
>>
>> Thanks Anthony,
>>
>> The idea is having both view and grid displayed in the same page.
>> The view is not made by the grid. It have to been displayed if the user
>> have clicked on the 'View' button, or not displayed if the user have
>> clicked on the "Search" or "Reset" button.
>>
>> The first time the page is displayed there's only the grid.
>> When the user click on a view button, the controller see that there's
>> 'view in the args', redirect the page to the same page with the record id
>> in vars instead of args. Like that the grid is not displayed in the view
>> mode but in the table mode.
>>
>> Controller:
>> if 'view' in request.args:
>> #I build the vars, one is called product_id, the other keywords
>> redirect(URL('my_page', vars=vars))
>>
>>
>> In the view:
>> {{if request.vars['product_id'] and session.view == True:}}
>>
>> The problem is that I have to detect which is the button that have been
>> clicked, for setting session.view.
>> I've tried with Ajax to set a session var but I've got delay problems.
>>
>> I need to know which is the last clicked button.
>> Can you help me?
>>
>
> The ajax should be invoking a controller (which sets the session variable)
> and getting a response, I think.
> There would be a round-trip time requirement for that,
> and THAT response handling can invoke the primary controller.
>
> Am I warm?
>
> /dps
>
>
>> Il giorno martedì 2 maggio 2017 18:45:04 UTC+2, Anthony ha scritto:
>>>
>>> You should be able to do this in the controller that handles the grid.
>>> Please show the code you tried and explain exactly what happened.
>>>
>>> On Monday, May 1, 2017 at 9:49:23 AM UTC-4, Gael Princivalle wrote:

 Hello.

 I would like to set a session var when the user click in a SQLFORM.grid
 on the search or reset buttons.
 I've tried with Ajax but the next page is processed before the session
 var has been set.

 Perhaps I can make a modification directly in the web2py files that are
 called when the user click on "Search" or "Reset"?

 Someone knows where they are?

 Thanks.

>>> --
> 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.
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Massimiliano

-- 
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.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: In SQLFORM.grid, setting a session var when the user click on search or reset

2017-05-03 Thread Dave S


On Wednesday, May 3, 2017 at 5:51:34 AM UTC-7, Gael Princivalle wrote:
>
> Thanks Anthony,
>
> The idea is having both view and grid displayed in the same page.
> The view is not made by the grid. It have to been displayed if the user 
> have clicked on the 'View' button, or not displayed if the user have 
> clicked on the "Search" or "Reset" button.
>
> The first time the page is displayed there's only the grid.
> When the user click on a view button, the controller see that there's 
> 'view in the args', redirect the page to the same page with the record id 
> in vars instead of args. Like that the grid is not displayed in the view 
> mode but in the table mode.
>
> Controller:
> if 'view' in request.args:
> #I build the vars, one is called product_id, the other keywords
> redirect(URL('my_page', vars=vars))
>
>
> In the view:
> {{if request.vars['product_id'] and session.view == True:}}
>
> The problem is that I have to detect which is the button that have been 
> clicked, for setting session.view.
> I've tried with Ajax to set a session var but I've got delay problems.
>
> I need to know which is the last clicked button.
> Can you help me?
>

The ajax should be invoking a controller (which sets the session variable) 
and getting a response, I think.
There would be a round-trip time requirement for that,
and THAT response handling can invoke the primary controller.

Am I warm?

/dps


> Il giorno martedì 2 maggio 2017 18:45:04 UTC+2, Anthony ha scritto:
>>
>> You should be able to do this in the controller that handles the grid. 
>> Please show the code you tried and explain exactly what happened.
>>
>> On Monday, May 1, 2017 at 9:49:23 AM UTC-4, Gael Princivalle wrote:
>>>
>>> Hello.
>>>
>>> I would like to set a session var when the user click in a SQLFORM.grid 
>>> on the search or reset buttons.
>>> I've tried with Ajax but the next page is processed before the session 
>>> var has been set.
>>>
>>> Perhaps I can make a modification directly in the web2py files that are 
>>> called when the user click on "Search" or "Reset"?
>>>
>>> Someone knows where they are?
>>>
>>> Thanks.
>>>
>>

-- 
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.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: In SQLFORM.grid, setting a session var when the user click on search or reset

2017-05-03 Thread Gael Princivalle
Thanks Anthony,

The idea is having both view and grid displayed in the same page.
The view is not made by the grid. It have to been displayed if the user 
have clicked on the 'View' button, or not displayed if the user have 
clicked on the "Search" or "Reset" button.

The first time the page is displayed there's only the grid.
When the user click on a view button, the controller see that there's 'view 
in the args', redirect the page to the same page with the record id in vars 
instead of args. Like that the grid is not displayed in the view mode but 
in the table mode.

Controller:
if 'view' in request.args:
#I build the vars, one is called product_id, the other keywords
redirect(URL('my_page', vars=vars))


In the view:
{{if request.vars['product_id'] and session.view == True:}}

The problem is that I have to detect which is the button that have been 
clicked, for setting session.view.
I've tried with Ajax to set a session var but I've got delay problems.

I need to know which is the last clicked button.
Can you help me?

Il giorno martedì 2 maggio 2017 18:45:04 UTC+2, Anthony ha scritto:
>
> You should be able to do this in the controller that handles the grid. 
> Please show the code you tried and explain exactly what happened.
>
> On Monday, May 1, 2017 at 9:49:23 AM UTC-4, Gael Princivalle wrote:
>>
>> Hello.
>>
>> I would like to set a session var when the user click in a SQLFORM.grid 
>> on the search or reset buttons.
>> I've tried with Ajax but the next page is processed before the session 
>> var has been set.
>>
>> Perhaps I can make a modification directly in the web2py files that are 
>> called when the user click on "Search" or "Reset"?
>>
>> Someone knows where they are?
>>
>> Thanks.
>>
>

-- 
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.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: In SQLFORM.grid, setting a session var when the user click on search or reset

2017-05-02 Thread Anthony
You should be able to do this in the controller that handles the grid. 
Please show the code you tried and explain exactly what happened.

On Monday, May 1, 2017 at 9:49:23 AM UTC-4, Gael Princivalle wrote:
>
> Hello.
>
> I would like to set a session var when the user click in a SQLFORM.grid on 
> the search or reset buttons.
> I've tried with Ajax but the next page is processed before the session var 
> has been set.
>
> Perhaps I can make a modification directly in the web2py files that are 
> called when the user click on "Search" or "Reset"?
>
> Someone knows where they are?
>
> Thanks.
>

-- 
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.
For more options, visit https://groups.google.com/d/optout.