PDA

View Full Version : Working with multiple controllers



srxx123
4 Aug 2012, 3:42 AM
Hi,
I have an application with 2 controllers. THe main controller and a second which shall manage a ChangePassword view.

The ChangePassword controller has a funtion show which shows the ChangePassword window - the view.

this.getController('ChangePassword').show();

This works fine. The problem is that onChangePasswordButtonClick is never called when I click the button. I think I have done something wrong with the controller or the view or both. What's the problem here?



Ext.define('Foo.controller.ChangePassword', {
extend: 'Ext.app.Controller',

views: [
'ChangePassword'
],


onChangePasswordButtonClick: function(button, e, options) {
alert('M');
},

show: function() {
this.v.show();
},

init: function(application) {
this.control({
"button[id='btnChangePassword']": {
click: this.onChangePasswordButtonClick
}
});
this.v = this.getChangePasswordView().create();
}

});

srxx123
6 Aug 2012, 8:23 AM
Damned, the selector was simply wrong, it was not id, but itemId...