PDA

View Full Version : Inter-controller communication using fireAction



JHuybrighs
1 Feb 2012, 5:06 AM
Probably a stupid question but the ST documentation (in dev/...) lists the 'fireAction' method for a controller. It says:
...Fires the specified event with the passed parameters and execute a function (action) at the end if there are no listeners that return false...
That would suggest that another controller can process the action event. If so how would this other controller then have to register for this event?
I assume it cannot do this using 'this.control(...)' since I have learned that this only works for view/dom type of events. Using 'this.getApplication().on(..)' doesn't seem to work either.

I stumbled upon this when trying to come up with a general purpose/re-usable controller that would have to pass result data coming from its view to another controller.

mitchellsimoens
1 Feb 2012, 9:08 AM
If you fire an event on the controller then you should just use this.on in the init method. If you want another controller to listen for it one would argue to fire the event on the application but you can resolve another controller using this.getController in a controller.

alile
13 Dec 2012, 2:10 PM
I found the solution here: http://www.sencha.com/forum/showthread.php?146752-Communication-between-controllers