在extjs中,如何改变combobox中store的值。

问题:

    this.tableCombo = new Ext.form.ComboBox({
        id : 'tableCombo',
        name : 'table',
        typeAhead : true,
        triggerAction : 'all',
        lazyRender : true,
        store:new Ext.data.SimpleStore({
                                                                    id : 0,
                                                                    fields : [ 'table', 'descr' ],
                                                                    data : [ [ 'OPT', 'Option' ], [ 'T', 'Temp' ] ]
                                                                    }),
        triggerAction : 'all',
        valueField : 'table',
        displayField : 'descr',
        mode : 'local',
        allowBlank : false
    });  


 譬如 点击一个按钮完,重新给 这个combobox中的store赋值。


方法:重新定义:

this.tableCombo = new Ext.form.ComboBox({
        id : 'tableCombo',
        name : 'table',
        typeAhead : true,
        triggerAction : 'all',
        lazyRender : true,
        triggerAction : 'all',
        valueField : 'table',
        displayField : 'descr',
        mode : 'local',
        allowBlank : false
    });



function clickbutton(){

var tableComboStore = new Ext.data.SimpleStore({
                                                                    id : 0,
                                                                    fields : [ 'table', 'descr' ],
                                                                    data : [  [ 'I', 'Field' ], [ 'ID', 'Modifier' ], [ 'T', 'Temp' ] ]
                                                                    });

this.tableCombo.store = tableComboStore;
                                                    this.tableCombo.bindStore(tableComboStore);

}

你可能感兴趣的:(Extjs)