PDA

View Full Version : Binding events on multiple controllers



prasanth_kodali
17 Feb 2014, 3:26 AM
Hi,

There are a set of components in my extjs (v 4.1.2) application as below:

- A view V1 whose controller is C1.
- Another view V2 being being controlled by controller C2.

What is the best approach to listen for events in V1 and update V2?

Currently I have created a new top-level controller C3 that listens for a click event in V1 and updates V2 directly. (I feel it not to be a right way of doing it, though, and intend to replace it with a better implementation)

After adding the thrid controller C3, I started to notice some strange behaviour in my application - the click event on V1 which C3 handles is also handled by C1. Things run fine normally.

But when I try to debug and add a break point in the event-handler in C1, the code in C3's event handler does not execute at all, even after clicking on the 'continue' button in the Chrome debugger, which appears to be strange. What could be causing this behaviour in debug mode?

Thanks in advance for any helpful response.

ssamayoa
17 Feb 2014, 6:41 AM
click event on V1 which C3 handles is also handled by C1

Check your controlQuery in both controllers because seems that both controllers are competing for the same event in the same view.

Regards.