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
extjs extjs4.2


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 to share


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

      

+2


source to share


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

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

      

+1


source to share


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 to share


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 to share







All Articles
Loading...
X
Show
Funny
Dev
Pics