PDA

View Full Version : ComboBox Empty Values



Yondaime
8 Feb 2008, 9:08 AM
Here is my suggestion on how to allow an empty value on a ComboBox:



Ext.override(Ext.form.ComboBox, {
onKeyUp : function(e){
if(this.editable !== false && !e.isSpecialKey()){
this.lastKey = e.getKey();
this.dqTask.delay(this.queryDelay);

if(this.allowBlank && this.getRawValue() == '' && (this.lastKey == Ext.EventObject.BACKSPACE || this.lastKey == Ext.EventObject.DELETE)){
this.clearValue();
this.collapse();
}
}
}
});