Да споделя опит - трябваше ми прихващане на определени събития на *всички* инстанции на определен клас. Същото нещо е описано в http://www.extjs.com/deploy/dev/docs/output/Ext.data.DataProxy.html:
And new in Ext version 3, attach centralized event-listeners upon the DataProxy class itself! This is a great place to implement a messaging system to centralize your application's user-feedback and error-handling.
// Listen to all "beforewrite" event fired by all proxies.
Ext.data.DataProxy.on('beforewrite', function(proxy, action) {
console.log('beforewrite: ', action);
});
Ето как се решава този проблем:
GeSHi (Javascript):
Ext.namespace('Ext.App');
Ext.App.Module = function (config)
{
this.addEvents
(
'beforeConfigure',
'afterConfigure'
);
Ext.App.Module.superclass.constructor.call(this, config);
Ext.App.Module.relayEvents(this, ['beforeConfigure', 'afterConfigure']);
}
Ext.extend(Ext.App.Module, Ext.util.Observable,
{
initModule : function ()
{
this.fireEvent('beforeConfigure', this);
// ... configure Module
this.fireEvent('afterConfigure', this);
}
});
Ext.apply(Ext.App.Module, Ext.util.Observable.prototype);
Ext.util.Observable.call(Ext.App.Module);