Вопрос

I am developing application using ExtJS 4.1. I have one spinner field and I want to change value of that method programatically. I have set up listeners like change, spinup and spindown for this same spinner field.

Now I would like to know how to prevent listener method of these events getting fired only when I change the value of spinner field through my program?

For example,

var mySpinner = Ext.ComponentQuery.query('#foopanel > #mySpinner')[0];
mySpinner.setValue(2000);

When mySpinner.setValue(2000); line is executed, change event of mySpinner gets fired and as I have listener method for this change event, that listener method is executed.

Is it possible to prevent invocation of change event listener method?

Thanks..

Это было полезно?

Решение

You could suspend all events by calling

mySpinner.suspendEvents();
mySpinner.setValue(2000);
mySpinner.resumeEvents();

That would be the cleanest an easiest way IMO

And that's also a usecase why this methods exist

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top