在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);
}