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

Viewed 55287

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
},
5 Answers

As an alternative, I faced the need to show a locally stored Store, which was just a matter of listening the afterRender method:

listeners: {
    afterRender: function() {
        this.select(01);
    }
}

01 in this case is the id (valueField) of the element in the Store:

areasCenters: {
        data: [{
                id: 01,
                name: 'Todas'
            },
            {
                id: 02,
                name: 'Elegir...'
            }
        ],
        autoLoad: true
}
Related