View Full Version : How to call one controller function from another one?

13 Feb 2014, 7:12 AM

I was wondering how I can call a controller's function from within another one of the controller's functions? For instance, I have my MainController which has functions exampleOne and exampleTwo, in the code for exampleTwo:

exampleTwo: function () {

//how do I call exampleOne() here?


I'm guessing I need to reference the controller and then call it's function, I just don't know how, please help.

13 Feb 2014, 7:15 AM
There's a ton of info here (http://nohuhu.org/development/using-synchronous-bidirectional-communication-with-controllers/).

13 Feb 2014, 7:42 AM
Hi Les,

I can't seem to get this to work, whenever I call this.getController() from within one of it's actions/functions, for example:

var option = this.getController('mainController');

I get the error: 'object is not a function' VM3195:3

Which looks like this:

/**/) {
return new c(a[0])

13 Feb 2014, 7:43 AM
You need to use the name of the controller instead of id.

This is a bug in Ext JS.