EXTJS Error loading callback

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 fact is that I want this call to start again when the store first loads. I want to delete it after this so that when reloading or loading the store, it does not call this callback again.

Any idea, I tried to get a callback in the parameter settings, but this does not work.

+6
source share
1 answer

Not quite sure what the problem is. A callback will only be called when loading a store with a callback.

 store.load({callback:myCallback}); //callback will be called store.load(); //callback will not be called 

If you just want to do something, as soon as you want to use a single-set listener in true. Listeners instead of callbacks is my preferred way.

 store.on('load', onStoreLoad, this, {single:true}); 

The arguments to the api callback function are slightly different from the load listener, check the docs to see them.

+14
source

All Articles