Page 1 of 1

waitForStoresToLoad() question

Posted: Thu Oct 06, 2011 3:19 pm
by fredric berling
Is the waitForStoresToLoad function meant to automatically load the stores sent into it? .. It does that. I don't want that.. :)

I would see it more useful to use for watching a store and then let the callback run whenever its loaded. Loading called from elsewhere in the code.

btw. This testing suite ROCKS!!!!

Re: waitForStoresToLoad() question

Posted: Thu Oct 06, 2011 3:23 pm
by mats
Looks like Nickolay already thought of you:
// a secret config option to prevent the "load" call on store
                if (!store.onlyListen) {
                    store.load();
                }
It's a hack for now, but we can definitely make improve this I think.

Re: waitForStoresToLoad() question

Posted: Thu Oct 06, 2011 3:31 pm
by fredric berling
Great. That worked just fine. :)

Could also be great to send as a parameter into the function, so we don't have to mess with the stores that we are testing.

Re: waitForStoresToLoad() question

Posted: Thu Oct 06, 2011 3:32 pm
by mats
already fixed, next version will have:
/**
         * Waits until all the passed stores have been loaded, but also calls load on each store. This method accepts any number of stores, followed by a callback function.
         * @param {Ext.data.AbstractStore} store1 The store to load.
         * @param {Function} callback A function to call when the condition has been met.
         */  
        loadStoresAndThen: function () {
        },

**
         * Waits until all the passed stores have been loaded. This method accepts any number of stores, followed by a callback function.
         * @param {Ext.data.AbstractStore} store1 The store to load.
         * @param {Function} callback A function to call when the condition has been met.
         */        
        waitForStoresToLoad: function () {
}