I'm just trying to refactor my Ext-js code in more OO way. I use Ajax.beforerequest event successfully until now. Since I wrapped my page code into a class, the event is not being called any more.
My current code looks like this:
Code:
function PageUI(config){
this.config = config;
}
PageUI.prototype = {
init: function(){
this.setupDataSource();
this.setupGrid();
this.loadData(); //invokes load() on Ext.data.Store instance with JsonReader = Ext.Ajax request
}
...
}
var gui = new PageUI({loaderURL: 'xx'});
Ext.onReady(function(){
Ext.Ajax.on('beforerequest', function(){ alert('request'); });
gui.init();
}, gui, true);
I tried to move the beforerequest event registration around - into the PageUI.init method etc, but nothing worked - the alert is never shown. I use exactly the same approach in my pages which are not OO-refactored yet and it works there without any problems..
anybody has an idea what am I doing wrong?