I have a numberfield and a list in Sencha Touch. When I click on an item in the list, I am doing an AJAX request to send data to the server. However, if there is data in the numberfield, I want to clear that when the list is clicked on.
I have no problem doing this (I am setting the value to a blank string), however, the change event is fired on the numberfield. This causes another AJAX request to run which doesn't need to. Is there any way to clear a numberfield WITHOUT firing the change event? SuspendEvents does not work as clearing the numberfield requires an event.
Any thoughts or suggestions? Thanks!
Code lines that I have tried:
suspendEvents();
me.getWhatScreen().down('numberfield[name=caseNumber]').setValue('');
resumeEvents(true);
me.suspendEvents();
me.getWhatScreen().down('numberfield[name=caseNumber]').setValue('');
me.resumeEvents(true);
Do suspendEvents()
, update your numberfield and then do resumeEvents()
UPDATE
var control = me.getWhatScreen().down(...);
control.suspendEvents();
control.setValue('');
control.resumeEvents(false);
UPDATE for Sencha Touch 2.4
the correct sequence is
var control = me.getWhatScreen().down(...);
control.suspendEvents();
control.setValue('');
control.resumeEvents(true);
resumeEvents takes the boolean parameter discardQueuedEvents
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With