PDA

View Full Version : DataStore - Can I add a listener on success to interrogate XML received?



RobWilson
6 Jan 2011, 7:21 AM
Hi,

I have a datastore that I wish to clear everything from, then invoke a web-service, which happens to send data back in chunks, until an attribute in the XML indicates remaining="0".



// Remove any existing items in the grid
datastore.removeAll();

// Add - Indicator to append loaded records rather than
// replace the current cache.
datastore.load({
add:true
});Currently my datastore will load the initial set of data, then stop. Is there any way I can add a loaded event, interrogate the XML, then if the remaining item count > 0 call datastore.load({add:true}) again?

The XML response would be similar to


<root>
<value>99</value>
<quotes expected="10" remaining="5">
<quote>
..
</quote>
<quote>
..
</quote>
</quotes>Also, can I abort a store load? Then I can invoke an abort before clearing the store and starting the service again, without fear of the older service response completing later, injecting stale data.

Thanks,
Rob.