Hello everyone,
I'm trying to create a custom event that fires whenever data is received from an Ext.Ajax request. Firebug keeps telling me "this.fireEvent is not a function". Here's a simplified version of my code:
Code:
//Object Definition
DataManager = Ext.extend(Ext.Panel, {
initComponent:function() {
console.log("initComponent");
DataManager.superclass.initComponent.apply(this, arguments);
this.addEvents('data');
},
sendAndReceive:function() {
console.log("sendAndReceive");
Ext.Ajax.request({
url: 'http://zeezor.thermosites.com/php/test.php',
success: this.onData,
})
},
onData:function(objServerResponse) {
console.log("onData");
this.fireEvent('data', this);
}
});
//Object Instantiation & Usage
var dataManager = new DataManager();
dataManager.sendAndReceive();
dataManager.on('data', function() {
console.log("custom event received!");
});
I'm desperate. Can anyone help?