View Full Version : toggle button's event handler not called when toggle() called

25 Jan 2014, 6:56 PM
In this fiddle I have two buttons A and B.
If you hit A, it is toggled 'on' and it's event-handler is called.
If you hit B, button A is toggled off but it's event handler is not called, even though 'SupressEvents' is 'false'.


How can I make it so that A's event handler is called when it is 'toggle'd programatically?

27 Jan 2014, 1:30 AM
I have made a work-around by calling the buttons click handler after the toggle(), but I would have expected toggle() to work this way by itself

btn.toggle(false); // set toggle 'off'
btn.fireEvent('click', item); // fire event handler

27 Jan 2014, 2:35 AM
The toggle method is only about a dozen lines long. It's pretty easy to see what's going on if you just look at the source code.

The event fired is called toggle and the handler is called toggleHandler.