SuspendEvents on checkbox not working
I check the box programmatically,
since I am setting it dynamically, I want to pause (change the event) events on it because when I change the checkbox, I have other things to do.
I've already tried the following code, but it doesn't work.
checkbox.suspendEvents(false);
checkbox.setValue(true);
checkbox.resumeEvents();
thank
... setRawValue (true); the method will not fire a change event.
Seems like extjs bug a workaround is to set checkbox.lastValue = true;
along with setRawValue to detect the next change event.
The suspendEvent is also available for the combobox. Here are the error reports:
- http://www.sencha.com/forum/showthread.php?171525-suspendEvents-did-not-affect-to-Ext.app.Controller.control
- http://www.sencha.com/forum/showthread.php?232919-ComboBox-suspendEvents-doesn-t-work
I found a solution that fixes it for comboboxes. Maybe the solution works for checkboxes too. It works in Ext JS 4.2.1. Perhaps other versions too.
checkbox.suspendCheckChange++;
checkbox.setValue(true);
checkbox.suspendCheckChange--;
Even though you can't go wrong with your code, you've tried:
checkbox.suspendEvent('change');
checkbox.setValue(true);
checkbox.resumeEvent('change');
The suspendEvent and resumeEvent function does not apply to event listeners defined in the controller, only to event listeners directly on the component.
newmount is the best solution
If you are on the page reset the value that was (say, on failure to confirm or save).
checkbox.reset ();
Works great in extjs 4.2.2