PDA

View Full Version : ComboBox - easy to clear



andrei.neculau
4 Aug 2007, 5:42 AM
I was looking at all the ClearableComboBox and all the twin triggers, and such.. but why shouldn't the combobox be cleared out simply by deleting the text?!

When you have forseSelection:true, and you delete the inner text, then the combobox will go with the previous selection.

Here's a "fix":

Ext.apply(Ext.form.ComboBox, {
doForce : function(){
if(this.el.dom.value.length > 0){
if (this.el.dom.value == this.emptyText) {
this.clearValue();
}
else {
this.el.dom.value =
this.lastSelectionText === undefined ? '' : this.lastSelectionText;
this.applyEmptyText();
}
}
}
});

fangzhouxing
4 Aug 2007, 10:49 PM
I still like the solution of wck555:
http://extjs.com/forum/showthread.php?p=51848

andrei.neculau
28 Aug 2007, 10:14 AM
Well, I can imagine.. it has .. A BUTTON :)
I like it clean and simple - if the comboBox let's you type, it should also let you delete, therefore clear it!
I would like the other solution, if it were a "general" solution - meaning that all fields would have a button, etc... but then you need to "fix" all the fields, as they are right now.