EXTJS Store load callback issue
extjs, extjs4.1
Solution
Not exactly sure what the problem is. The callback will only get called when the store is loaded with the callback.
store.load({callback:myCallback});
//callback will be called
store.load();
//callback will not be called
If you want to just do something once you might want to use a listener with single set to true. Listeners instead of callbacks is my preferred way.
store.on('load', onStoreLoad, this, {single:true});
The callback function arguments api is slightly different than a load listener, check the docs to see.
Problem
I load my store as follows: ``` store.load({ params: { paramMap }, callback: function(records, options, success) { if (success) { var form = formPanel.getForm(); var jsonStr = Ext.JSON.encode(records[0].raw); var jsonObj = Ext.JSON.decode(jsonStr); form.loadRecord(jsonObj); } } }); ``` The thing is I only want this call back to fire the first time the store is loaded. I want to remove it after that so that when I reload or load the store again it doesn't call this callback again. Any idea, I tried getting the callback in the options config but that doesn't seem to work.