Some frameworks have active data widgets - the widget updates whenever data changes. I'm not sure how exactly it can be implemented in web2py, but something like this should work:
View (.html file): ------------------------ <div id="mywidget">{{=mywidget}}</div> <script> setTimeout(refreshWidget, 10000); // calls refreshwidget every 10 seconds function refreshWidget() { ajax('refresh_widget', [], 'mywidget'); } </script> Controller (.py file) --------------------------- def refresh_widget(): # logic to generate widget return dict(mywidget=mywidget) Explanation: Every 10 seconds there's an ajax call to controller's refresh_widget, which generates the HTML for the updated view that you want to show inside the mywidget tags (like list of elements). This HTML is placed inside the mywidget tag. This is the simplest way to solve this problem that I can think of, and this is not efficient because even if your data has not changed, you'll still be polling the server every 10 seconds. But this should work! On Jul 9, 1:32 am, Tomas Pelka <tompe...@gmail.com> wrote: > Hi all, > > Im trying to create widget (lets say list of elements) which should by > updated asynchronously through ajax. I don't get all the ajax examples > in web2py book for example. Those examples only deals with some action, > like on click, on mouse move, on sbutton submit or so. I need something > like check if queue (source of data) have anything to provide or simple > use a timer and reload widget every e.g. 10 sec. > > Thanks for advices. Please let me know if anything was unclear/wrong > described. > > -- > Tomas Pelka