PDA

View Full Version : reset not working in combo combobox



emredagli
12 Aug 2009, 12:42 AM
Hii,
I have a combo like that:


var storeSiteWideFontSize = new Ext.data.SimpleStore({
fields:[
{name:'text', type:'string'},
{name:'value', type:'int'},
{name:'fontfamily', type:'string'}
],
data:[
['xx-small',0,'Arial'],
['x-small',1,'Arial'],
['small',2,'Arial'],
['medium',3,'Arial'],
['large',4,'Arial'],
['x-large',5,'Arial']
]
});

{
id: 'comboSectionFontSize',
xtype: 'combo',
editable: false,
store: storeSiteWideFontSize,
emptyText:'Click to Select...',
displayField: 'text',
typeAhead: true,
triggerAction: 'all',
mode: 'local',
valueField: 'value',
width:70,
forceSelection: true,
tpl:new Ext.XTemplate(
'<tpl for="."><div class="x-combo-list-item" style="font-family:{fontfamily};font-size:{text}">{text}</div></tpl>'
)
}


I use this combo for selection of font-size.
But when I try to reset this field (try to display nothing, only empty text).

"Ext.getCmp('comboSectionFontSize').reset();"

It shows "xx-small".

I try to comment it out: "forceSelection: true", but doesn't work...

Is it normal? Or do I miss something again... ?

Thanks for your help.

jarlau
12 Aug 2009, 12:51 AM
As per the doc says, reset()


Resets the current field value to the originally-loaded value and clears any validation messages. Also adds emptyText and emptyClass if the original value was blank.


you may try clearValue().

emredagli
12 Aug 2009, 1:01 AM
Dear Jarlau,

I give up to show empty text.

clearValue is also enough for me.


This is the second time to help me.
Thanks a lot.

Animal
12 Aug 2009, 3:16 AM
Configure it with value: ''

emredagli
12 Aug 2009, 3:37 AM
Dear Animal,

But in that case when first rendered I saw "xx-small" (with gray color).
So I need to call clearValue() after render if I use value config.

Thanks for your reply.