Search code examples
extjscomboboxextjs3

How to auto select (show) the first value of combobox in Ext Js?


This is my combobox

{
    xtype: 'combo', 
    fieldLabel: LANG.LOGIN_LANG,
    id : 'lang', 
    store: [
        ['tr','Türkçe'],
        ['ru','Русский'],
        ['en','English']
    ],
    mode: 'local',
    triggerAction: 'all',
    selectOnFocus:true
},

Solution

  • {
      xtype: 'combo', 
      fieldLabel: LANG.LOGIN_LANG,
      id : 'lang', 
      store:[['tr','Türkçe'],['ru','Русский'],['en','English']],
      mode: 'local',
      triggerAction: 'all',
      value: 'tr',
      selectOnFocus:true
    },
    

    For remote comboboxes you need to plug into store's load event to select the value after store is loaded.