I am using ExtJS 4.1. On the UI I have two buttons - btnOne & btnTwo. I have a store which I load after the click on both the buttons.
What I want: On click on any button, I still want to load the store but on click on btnOne, I want to load the store and when the store is loaded, I want to call a callback function. I cannot add the callback function on store load as I want to call the callback function only when btnOne is clicked.
I looked at the store load docs & load method actually allows a callback function.
store.load({
scope: this,
callback: function(records, operation, success) {
// the operation object
// contains all of the details of the load operation
console.log(records);
}
});
If the callback scope does not need to be set, a function can simply be passed:
store.load(function(records, operation, success) {
console.log('loaded records');
});
But in my case the callback function is getting called before the store load.
I do not want to maintain a variable for same.
Please suggest.