PDA

View Full Version : Controller for global/generic listeners? (what am I missing?)



Maxeta
25 Oct 2013, 10:00 AM
I am creating an enterprise system that uses a lot of Ext.Window objects, which are dynamically created/destroyed. I wanted to create a higher level controller for generic events, like getting created, getting minimized, etc. However I ran into an issue, here is my init code for the controller:



init: function () {
var me = this;
me.control({
'window': { add: me.doAdd },
'window': { minimize: me.doMinimize }

});
},


Now the problem is... only the last entry takes effect. So I can't handle both the add and minimize events. I'm hoping this is just a config issue on my side, and I'm not supposed to have two 'window' entries. But try as I might I can't seem to figure out how to add more than one event listener to a single 'window' entry.

Can anyone help me out on this one?

Tim Toady
25 Oct 2013, 10:21 AM
'window': {
add: me.doAdd,
minimize: me.doMinimize
}


You can't have two properties with the same name.

Maxeta
25 Oct 2013, 10:24 AM
Thanks, that worked. I swear I tried putting them both on the same 'window' property and got an error. But it's definitely working now, thanks again.