PDA

View Full Version : Store.load - isLoading check



LesJ
18 Jun 2015, 6:12 AM
ext-6.0.0.561
Why the me.loading (me.isLoading()) check is present only in the BufferedStore?

I think it'd be useful if it were also added in TreeStore and Store. :-?

Ext.define('Ext.data.BufferedStore', {
extend: 'Ext.data.ProxyStore',
...
load: function(options) {
var me = this;

if (me.loading) {
return;
}
...

jsakalos
23 Jun 2015, 4:43 AM
Hmmm, isLoading is defined on ProxyStore. Normal Store inherits from ProxyStore so it should be ok to use on any store. http://docs.sencha.com/extjs/6.0/6.0.0-classic/#!/api/Ext.data.Store-method-isLoading

medoni
11 Oct 2015, 10:55 PM
I have the same problem in 6.0.1

// simple test case


var store = new Ext.data.BufferStore({
});
store.load();
console.log(store.isLoading()); // -> false


I think this affects all stores which have asynchronousLoad (https://docs.sencha.com/extjs/6.0/6.0.1-classic/#!/api/Ext.data.ProxyStore-cfg-asynchronousLoad) = true. ProxyStore.loading will be set to true in flushLoad (https://docs.sencha.com/extjs/6.0/6.0.1-classic/source/ProxyStore.html#Ext-data-ProxyStore-method-flushLoad) method. If asynchronousLoad is true (eg. BufferedStore) the flushLoad method is called with a timeout.

Maybe there is a need for a "isLoadingOrLoadWasTriggered" method. For example:


Ext.override(Ext.data.ProxyStore, {
isLoadingOrLoadWasTriggered: function() {
return this.isLoading() || !!this.pendingLoadOptions;
}
});