Data sets can reload their data at a specified interval expressed in milliseconds. This can be handy when the data at a given URL changes periodically.
To tell a data set to load at a given interval,
pass the optional loadInterval option when calling
the XMLDataSet constructor, and make sure the useCache option
is set to false:
// Load the data every 10 seconds. Turn off the cache to make sure we get it directly from the server.
var dsPhotos = new Spry.Data.XMLDataSet("/photos.php?galleryid=2000", "/gallery/photos/photo", { useCache:
false, loadInterval: 10000 });
You can also turn on this interval loading programmatically with the startLoadInterval() method, and stop it with the stopLoadInterval() method.
dsPhotos.startLoadInterval(10000); // Start loading data every 10 seconds. ... dsPhotos.stopLoadInterval(); // Turn off interval loading.