Hello,
Is there a (good/without problems) possibility (a method doesn't seem to exist, does it?) to find out whether a data store was already loaded?
Thanks.
Hello,
Is there a (good/without problems) possibility (a method doesn't seem to exist, does it?) to find out whether a data store was already loaded?
Thanks.
just check the store's total items using store.getCount(). If its above 0 then your store has loaded, else not! getCount retrieves the cached records, and getTotalCount() retrieves the total items in the data set.
varunach,
1 at which moment?
2 if store was loaded with no data?
1) You can use it at whenever you need to perform any operation with the store or any component the store is attached too. No need of an event.
2) If the store is loaded with no data, the function will return 0. In this case you'll need to use the load event.
If you want to perform an operation after the store has loaded, then use the 'load' event of the store and write the business logic inside the load event function. Whenever the store gets loaded the event will be fired. The load event will be fired each time the store is loaded. So if you do call reload() function, the load event will be fired again.
dear icvg,
if you wanna more, can you try byuself (practice if better than theory in this case) or could you explain more about your expectations (may be share code )
thx
You can add an isLoaded() method yourself:
or the equivalent Ext.extend().Code:new Ext.data.Store({ ... loaded: false, isLoaded: function() { return this.loaded; }, listeners: { load: function(store) { store.loaded = true; } } });