PDA

View Full Version : Not able to suppress combobox change event



nashrulez
27 Feb 2014, 10:39 PM
Hi,

I have a combo box which has a store containing more than 200 items. Whenever a user changes the value in the combobox an event is fired using the 'change' event of the combobox. This should happen only when the user is editing the form.

In case where I just need to populate the form using the SetValue() method the change event is fired. In order to suppress that , I used the suspendEvent('change') and resumeEvent('change') on the combobox. My code is as follows.

mycombobox.suspendEvent('change');
mycombobox.setValue(value);
mycombobox.resumeEvent('change');

This works only in cases where the store items are less. If the store items are huge , the suspendEvent and resumeEvent happens too quick without the value being set to the combobox.

Can any one please mention how I could solve this issue?

Thanks

scottmartin
28 Feb 2014, 5:47 AM
Have a look at combo.setRawValue()


Sets the field's raw value directly, bypassing value conversion, change detection, and validation. To set the value with these additional inspections see setValue.

nashrulez
28 Feb 2014, 9:21 AM
But it does not set the displayvalue of the combo box.

devtig
13 Feb 2015, 2:47 AM
There's a bug report here:
- http://www.sencha.com/forum/showthread.php?171525-suspendEvents-did-not-affect-to-Ext.app.Controller.control
(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 (duplicate)

I found a solution:


mycombobox.suspendCheckChange++;
mycombobox.setValue(value);
mycombobox.suspendCheckChange--;