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

+3


source to share


5 answers


... 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.

+7


source


The suspendEvent is also available for the combobox. Here are the error reports:



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--;

      

+2


source


Even though you can't go wrong with your code, you've tried:

checkbox.suspendEvent('change');
checkbox.setValue(true);
checkbox.resumeEvent('change');

      

+1


source


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

0


source


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

0


source







All Articles