
Originally Posted by
Animal
Original thread:
http://extjs.com/forum/showthread.php?t=39409
The basis is that when typeahead is enabled, the Combo's Store is filtered to only expose those items which match.
If the Combo is blurred, and therefore removed in that state, the filter is not cleared.
So next time the Combo is made visible in the document, and has its value set to the chosen cell value, the Store is still filtered and the value will not be found, so it gets used as the
raw value.
A fix could be changing setValue so that it uses the store
unfiltered:
Code:
Ext.override(Ext.ComboBox, {
setValue : function(v){
var text = v;
if(this.valueField){
this.store.clearFilter();
var r = this.findRecord(this.valueField, v);
if(r){
text = r.data[this.displayField];
}else if(this.valueNotFoundText !== undefined){
text = this.valueNotFoundText;
}
}
this.lastSelectionText = text;
if(this.hiddenField){
this.hiddenField.value = v;
}
Ext.form.ComboBox.superclass.setValue.call(this, text);
this.value = v;
}
});
I think I've just run into this as well. In my case the combo doesn't have a valueField. So maybe the clearFilter() should be before the if test?
Max
Code:
Ext.override(Ext.ComboBox, {
setValue : function(v){
var text = v;
this.store.clearFilter();
if(this.valueField){
var r = this.findRecord(this.valueField, v);
if(r){
text = r.data[this.displayField];
}else if(this.valueNotFoundText !== undefined){
text = this.valueNotFoundText;
}
}
this.lastSelectionText = text;
if(this.hiddenField){
this.hiddenField.value = v;
}
Ext.form.ComboBox.superclass.setValue.call(this, text);
this.value = v;
}
});