And one more thing, in javascript check if return value is -1 before you refresh your widget via document.yourwidget.innerHTML = msg call. This will make sure the widget refreshes only if you want it to (driven by your controller logic).
-- Adi On Jul 27, 9:56 am, Adi <aditya.sa...@gmail.com> wrote: > Hi Tomas, > > Are you sure setTimeout is not calling refreshWidget every second? Can > you debug the javascript and see what's happening (in Firebug)? > > Your problem is not to load the widget once by Ajax (which is what I > think the LOAD call will do), but to load it repeatedly. Also, if your > list of items is not changed you probably don't want to refresh. So > here I try again: > > Your controller should have a function which is something like this > (pseudocode follows) > > controller.py > ------------------ > def refresh_widget(): > # check if anything has changed. > # if nothing has changed, return some code like -1 > # if something has changed, then create the html using helpers > my_widget = DIV('') > for i in myitems: > my_widget.append(DIV(i)) # suit this as per whatever html you're > trying to build here > > return my_widget > > The view should be the same as I suggested, and the line > setTimeout(refreshWidget, 1000); > should get called all the time. > > In function refreshWidget(), add this line in the end > setTimeout(refreshWidget, 1000); > > This recursive call will ensure that every 1 second your function is > called again. This was missing earlier. > > Let me know how it goes! If you want I can look at your code and help > out. > > -- Adi > On Jul 27, 12:28 am, Tomas Pelka <tompe...@gmail.com> wrote: > > > > > Hi, > > where could I find implementation of LOAD (like > > {{=LOAD('sniffer','getResults',ajax=True)}}) function? > > > Thanks > > > -- > > Tomas Pelka