Question

Here is my code -

Store = new Ext.data.JsonStore({
url: 'url',
totalProperty: 'count',
id: 'Code',
root: 'rows',
autoLoad: true,
triggerAction: 'all',
fields: ['title', 'description'],
listeners: {
    load: {
        fn: function (store) {
            Ext.getCmp('Combo').setValue(store.getAt('1').get('title'));
            Ext.getCmp('Combo').fireEvent('select');
        }
    }
}
}
);

xtype: 'combo',
id: 'Combo',
store: Store,
fieldLabel: 'title',
displayField: 'title',
valueField: 'title',
typeAhead: false,
editable: false,
allowBlank: false,
mode: 'local',
emptyText: 'Select...',
forceSelection: true,
triggerAction: 'all',
name: 'DefaultCombo',
selectOnFocus: true,
width: 150
, onSelect: function () {
alert('message');
}

Combobox value is being set here, but onSelect is not firing here. I am using 3.4 version

Was it helpful?

Solution

I tested out this in a fiddle. The onSelect function appears to only fire when a selection is made. However, if you add a listener for the select event instead that fire's in either case.

listeners: {
            select:function(){
                console.log('Select Event Fired!')
            }
        },
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top