PDA

View Full Version : Trying to access load event



bstras21
16 Dec 2011, 9:15 AM
Hello, I see in the source code for a store that onProxyLoad fires:


me.fireEvent('load', me, records, successful);However I can't seem to access it. I am creating a base store that all other stores descend from and I would like to capture this event:

Here is my custom.store:


Ext.define('MyApp.custom.Store', {
extend: 'Ext.data.Store',
listeners: {
load: function() {
alert('load event fired!');
}
}
});


Now in my controller I do this:


onLaunch: function() {
languageStore = this.getLanguageStoreStore();
languageStore.load({
scope : this,
callback: function(records, operation, success) {
console.log(records);
}


})


If I extend onProxyLoad I can get my code to work but it seems they want us to use the load event. Any help is greatly appreciated, thanks!

mitchellsimoens
16 Dec 2011, 11:34 AM
Ext.define('MyApp.custom.Store', {
extend: 'Ext.data.Store',

constructor: function() {
this.on('load', function() {});

this.callParent(arguments);
}
});

Don't put listeners like that on the prototype or the config object.

bstras21
16 Dec 2011, 12:27 PM
This worked, thanks for the heads up.