PDA

View Full Version : [CLOSED] View controllers hierarchy



phimaur
31 Aug 2015, 12:48 AM
Hey guys,

I set a panel with a button and both of them have its own view controller.
https://fiddle.sencha.com/#fiddle/t2u

When I tap the button the app does not look for the listener on the button level but only on the panel.

Isn't the button view controller supposed to do that?

Thanks
Philippe

evant
31 Aug 2015, 1:43 AM
See: https://www.sencha.com/forum/showthread.php?300377-Button-or-MenuItem-controllers&p=1097497&viewfull=1#post1097497

phimaur
31 Aug 2015, 2:15 AM
I reviewed my fiddle and it works now.
t2u

Based on what you are referring to, the third button should only trigger the main controller method, but it triggers both. What would you advise in order to nicely overwrite the components' controller method by the parent's controller?

Thanks

evant
31 Aug 2015, 3:05 AM
You're adding 2 listeners, they get merged upon construction time. The one on the class definition is mapped to the button controller. The other to the parent because it's on the instance.

Practically, I don't really see why you would have a controller on a button like that, seems rather odd.

phimaur
1 Sep 2015, 7:57 AM
That was just for test purpose.
What I am trying to achieve is to work with nested components which may have their own controllers or may be overwritten by the parent's controller.

Thanks for your feedback

Philippe