View Full Version : ComboBox - need to click 2 times to display the emptyText value.

24 Jan 2011, 7:11 AM
Here's my code: I've created a combo with years value inside. When I load the page, the combo is filled with 2011.
Then I select another value, it works fine. But if I want to select 2011 again, I need to click somewhere else in the page to see the value displayed in the combo.

Any help would be appreciated to explain me this strange behaviour.


var yearStore = ['2009','2010','2011'];

years = Ext.extend(Ext.form.ComboBox, {
initComponent:function() {
var config = {
store: yearStore,
name: 'comboYear',
id: 'comboYear',
fieldLabel: 'Year',
width: 80,
displayField: 'Year',
valueField: 'Year',
editable: false,
emptyText: 2011,
typeAhead: true,
forceSelection: true,
mode: 'local',
selectOnFocus: true,
triggerAction: 'all'
}; //eo config object

24 Jan 2011, 7:15 AM
Why do you have typeAhead true and editable false?

24 Jan 2011, 7:21 AM
Bad copy/paste, I only need editable:false. ...

24 Jan 2011, 7:39 AM
I've found the problem. I use value: '2010' instead of emptyText: '2010'