PDA

View Full Version : is it possible to stop event propagation form controller?



Webtel
3 Nov 2011, 4:50 AM
i have grid with defined itemdblclick event handler(that would be default behavior), i also have specified in Controller.control() other handler for event on that particular grid.

I d wish to have possibility to stop event propagation form the controller and not from the component. Now it works other way around. (returning false in component will prevent controller.controll handling)

Can this be done?

mitchellsimoens
16 Nov 2011, 12:01 PM
All events should pass in the EventObject which if you execute stopEvent() then it should stop the event from bubbling up.

Webtel
16 Nov 2011, 11:21 PM
my question is about direction of bubling.

im in controller and heve my listener fired then i can stop propagation BUT event handler defined int he component itself fires before it. so it wont be stopped (it already happened).

am i wrong?

mitchellsimoens
17 Nov 2011, 6:33 AM
If it is being listened internally by a widget, unless there is a before event that you can return false to stop it, there is no way.

Webtel
17 Nov 2011, 6:41 AM
ok. so im a little disappointed in controlling possibilities of controller. I guess it wont be changed?

mitchellsimoens
17 Nov 2011, 6:45 AM
Controllers are event driven but if there isn't a cancelable event then there isn't much a Controller can do. You can create an override to add a before event if you need one. Then a Controller can cancel it.