PDA

View Full Version : How to wait for Ext.data.JsonStore load?



volperubbia
12 Jun 2010, 11:12 PM
Hi,
it is possible to wait for Ext.data.JsonStore loading and execute
remaining code only after store was loaded?



var store1 = New Ext.data.JsonStore(...);
var store2 = New Ext.data.JsonStore(...);
...
store1.load();
store2.load();
...
...
// OTHER CODE
... my code ...
...


All loadings are asyncronous ok.
But ... it is possible, in any mode, to execute "... my code ... " only after
all stores was loaded??? Some like a "traffic light" ...

Tks.

fay
13 Jun 2010, 2:31 AM
JsonStore (http://www.extjs.com/deploy/dev/docs/?class=Ext.data.JsonStore) has a load event, just hook into that/them.



store1.on('load', function(...)
{
store2.load();
});

store2.on('load', function(...)
{
otherCode();
});

volperubbia
13 Jun 2010, 3:52 AM
Hi fay, tks for this solution.
Very good.

:-)