Thank you for your response. As you suggested, I am currently trying to get around this by manually adding the div layer (instead of LOAD helper) and setting the generated link from the controller using response.js. Snippet below:
In demo/f1.html: <div data-w2p_remote="/app/demo/f1.load" data-w2p_timeout="10000" data-w2p_times="20" id="mycontent">loading...</div> In controller f1: url = <generate url with vars/args from request> response.js = "var u = '" + url + "'; document.getElementById('req-content').setAttribute('data-w2p_remote', u);" I have an alert to verify that the data-w2p_remote is set correctly but the XHR is still made to the default page. Is there some sort of a trigger that lets the code in web2py.js know that the URL in the data-w2p_remote attribute was changed? That would resolve my problem!! Thank you very much for your help. Akash On Wednesday, August 2, 2017 at 8:08:23 AM UTC-7, Anthony wrote: > > >> 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.