PDA

View Full Version : Ext.form.ComboBox Display field is showing the &nbsp while selecting the value



priyapratheep
20 Jun 2012, 7:05 PM
Hi
I am using ExtJS3

In my combo box I am displaying values like below
Head1
Sub1.1
Sub1.2
Sub 1.3
Head2
Sub2.1
Sub2.2
Sub 2.3
Head3
Sub3.1
Sub3.2
Sub 3.3

It is displaying fine with the help of Ext.data.Store and setting display field in store .For spaceing I use
String displayVal="&nbsp" +"&nbsp"+"&nbsp"+ user.getScreenName();

The problem is while selecting value from combo it is displaying &nbsp&nbsp&nbspSub1.1 like that. I don't want &nbsp to show while selecting. Pls help me to sortout this problem

Thanks in advance

sword-it
20 Jun 2012, 10:22 PM
Hi!

textfields and textareas can not have formatted values in them.
and why are you using nbsp; for your display values.

below will work fine:-




displayVal=" "+ user.getScreenName();



or if you want to use nbsp, you need to override setValue() of combobox.

dimas-lex
27 Nov 2013, 7:42 AM
Yeah, I've just make a wrapper around setValue method:


var combo = new Ext.form.ComboBox({
....
});
var oldSetValueFn = combo.setValue;
combo.setValue = function(value) {
if (value !== '&nbsp') {
oldSetValueFn.call(combo, value);
}
};