PDA

View Full Version : How to set default value of the Combo without firing dirty, and dirty to be false.



vadimv
8 Feb 2012, 3:19 AM
Some code within the combo below:


listeners: {
'afterrender': function (combo) {
combo.store.load(function (records,operation, success) {
if(success) {
combo.setValue() // fires dirty event to combo and form and changes dirty to true, have to avoid this, because is default value.
}
});
}
}

thx for any help/suggestion.

Bokara
8 Feb 2012, 3:59 AM
I have founded this link with the same problem if i am wright:

http://stackoverflow.com/questions/5965416/extjs-4-combobox-default-value?answertab=votes#tab-top

Hope it helps.

vadimv
8 Feb 2012, 4:19 AM
thx for link but it doesn't help me. I could set the value directly and the originalValue too in order to have the dirty flag to false, but wondering if there's a clever technique, a method or sth.

vadimv
8 Feb 2012, 5:39 AM
for example I can get the wanted behavior if to use the following code:


combo.suspendEvents();
combo.setValue(value);
combo.resetOriginalValue();
combo.resumeEvents();

Bokara
8 Feb 2012, 5:40 AM
But you wont to minimize that to one line of code?