Ext.ComboBox 设置初始值

new Ext.form.ComboBox({
            id: 'mycmb',
            typeAhead: true,
            triggerAction: 'all',
            mode: 'local',
            valueField: 'ID',
            displayField: 'Name',
            value: '5307',//设置值           
            store: new Ext.data.JsonStore({
                proxy: new Ext.data.HttpProxy({
                    method: 'GET',
                    url: 'GoodsList.aspx'//相对路径
                }),
                fields: [{ name: 'ID' }, { name: 'Name'}],
                root: 'data',
                autoLoad: true
            }),
            listeners: {
                render: function(cmb) {
                    var store = this.getStore();
                    store.on('load', function() { cmb.setValue(cmb.getValue()); }, this); //初始化显示
                }
            }

        })

你可能感兴趣的:(ext)