PDA

View Full Version : Dynamically adding, Controller listener



sanfaow
1 May 2012, 10:00 AM
I generate views from response which is in JSON format. The view events are associated with some functions. I need to add listeners to controller on fly. Based on the event raised in the view respective javascript function would be called by the controller. Is this possible? Has anyone done this?

vadimv
1 May 2012, 11:18 PM
have you tried to add the listeners through control method ?

sanfaow
8 May 2012, 1:03 AM
I have String like :
{ '#login_button':{
click:function(button,e,options){
loadView(1,'tabPanel');
}
}
}
I want to use and provide relevant parameter to this.control of controller. Is there any way to do so?

vadimv
8 May 2012, 2:27 AM
use it as is used ussually:




this.control({
'useredit button[action=save]':{
click:this.updateUser
}
});

sanfaow
11 May 2012, 2:31 AM
I add functions to controller as shown below.
MyController.control(Ext.decode("{'#login_button': {click: this.onLogin_buttonClick} }"));

What I have observed is the login_button and click do get registered but ( checked in debug)
fireFn and fn appear as undefined............
Any ideas?

bluehipy
4 Jun 2014, 5:18 AM
I add functions to controller as shown below.
MyController.control(Ext.decode("{'#login_button': {click: this.onLogin_buttonClick} }"));

What I have observed is the login_button and click do get registered but ( checked in debug)
fireFn and fn appear as undefined............
Any ideas?


Ext,decode will not transform that into actual methods references.