24 Apr 2012 7:11 AM #1
Hi All, I need some conceptual direction on this please.
I have two controllers.. and all code/Views are fine independent of one another and function as I expect. Now suppose I create an event listener in controller 2 where I want it to perform some function in controller 1 or reference some view associated with controller 1.. I cannot seem to grab a reference for the life of me !! Is this even possible ? I would imagine it should be.. Help !! Thanks in advance.
p.s. I did try this.getController() and this.getView() - but did not have any luck with that
24 Apr 2012 7:43 AM #2
From controller2 use this.getApplication().getController('controller1') and then if you have references(refs) setup in controller1 you should be able to get reference to a viewBharat Nagwani
Sencha Designer Development Team
24 Apr 2012 9:57 AM #3
I'm getting this error
Uncaught TypeError: Object [object Object] has no method 'getApplication'
so I tried
since MyApp is the name of my Application..
Uncaught TypeError: Cannot call method 'getController' of undefined
and I tried several other variations..
I'll look into it more tomorrow when I have time, probably something simple I am missing.
24 Apr 2012 10:07 AM #4
getApplication() only works in Touch. Use .application in Ext.Aaron Conran
Sencha Architect Development Team
24 Apr 2012 10:48 AM #5
Thanks aconran, that got me the reference to the other Controller
var test = this.application.getController('shipControl');
From here I was able to call a method in the other controller..
Appreciate the help..