Page 1 of 1

How to Refresh MobileList without refreshing screen?

Posted: Sat Mar 10, 2012 3:31 pm
by Al Veitas

We have a screen with a mobile list that is populated via a REST service call. Once the page is loaded and mobile list is rendered, is there an "easy" way (or any way) to setup a timer where we could call the rest service and have the mobile list update? Preferably, we could already use what is generated by Tiggzi when the page is loaded (call rest service, load mobile list, etc).


How to Refresh MobileList without refreshing screen?

Posted: Sat Mar 10, 2012 9:51 pm
by maxkatz

Create new JavaScript file (Project Create New...) and add this code:

code
window.setInterval(function() {
servicename.execute({});
}, 5000);
/code

above service will be invoked every 5 seconds.

I didn't try it on a device but in desktop browser you also would need to call clearInternval() when you navigate to another page as the navigation happens in a frame. If you don't call it, the service would be invoked on every page.

Here is more info:
http://stackoverflow.com/questions/22...
http://www.w3schools.com/jsref/met_wi...

Hope this helps...