I work in extjs4. I am stuck at the point where I want to dynamically load the controller in extjs4. I am using the controllers this.getController () method to dynamically load the controller. * When I put this code in the init () function of a specific controller, then it works and the controller loads dynamically. * Here is my controller code ...
Ext.define('B.UserController',{
----
init:function()
{
var controller = this.getController('kp.PollController');
controller.init();
this.control(
{
'KpLogin button[action=loginAction]':
{
click:this.authenticateUser
},
});
},
-----
But when I put my code in a specific function (button event), then it gives me an error. Here is my code ...
Ext.define('B.UserController',{
-------
init:function()
{
this.control(
{
'KpLogin button[action=loginAction]':
{
click:this.authenticateUser
},
});
},
authenticateUser:function(button)
{
var controller = this.getController('kp.PollController');
controller.init();
}
-----
After posting this code, then I got an error in firebug ...
Uncaught TypeError: Cannot read property 'readyState' of undefined Connection.js:818
Ext.define.onStateChange Connection.js:818
(anonymous function)
Here is my app.js code ....
Ext.application({
name:'B',
autoCreateViewport:true,
controllers:['sn.UserController','qb.QbquestionController','kp.DnycontentController','kp.KpquotationController','qb.QbqnsController','kp.CuriosityquestionController','kp.WordController','kp.DnycontentcategoriesController'],
launch:function()
{
console.log('Application launch');
},
});
I do not know what is going wrong. Please give me some suggestions ....