> > > 1. My actual goal is to load this grid and keep refreshing it every 10 > seconds through XHR. For this, I created a simple view "demo/f1.load" > which > contains {{=grid}} and the "demo/f1.html" view has the following: > {{=LOAD('demo', 'f1.load', ajax=True, content='Loading...', times=20, > timeout=10000, user_signature=True)}} > 2. This works as intended until I navigate to page 2 of the grid. Once > I do that, the next XHR trigger based on the timeout takes me back to page > 1 (as opposed to refreshing page 2). > > The LOAD helper simply generates the following HTML:
<div data-w2p_remote="/demo/f1.load/index" data-w2p_timeout="10000" data-w2p_times="20" id="c86986894951">loading...</div> The code in web2py.js then reads those data-* attributes and sets up the process of repeatedly loading the URL specified by data-w2p_remote. It will keep reloading that same URL no matter what. > > 1. Is there a way to maintain state for the page number in the > "demo/f1.html" view and then pass it to the LOAD helper so that the next > XHR does not take the user back to page 1 of the grid? > > There is no built-in mechanism for this. You would have to code this on your own in Javascript (you won't be able to use the "timeout" and "times" arguments to handle the reloading). You could set up a jQuery ajaxComplete handler -- check for the "web2py-component-element" request header, and if it matches the component target ID, grab the request URL and use it as the new URL for the component reloads. 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 web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.