var comboxStore = Ext.create('Ext.data.Store', {
fields: ['value', 'name'],
data : [
{"value":1, "name":"1"},
{"value":2, "name":"2"}
]
});
var kcxzStore = Ext.create('Ext.data.Store', {
fields: ['kcdm', 'kcmc'],
proxy: {
type: 'ajax',
url:'LessonAction!getLessonByXnXqLsbh.action',
reader: {
type: 'json',
root: 'items',
totalProperty: 'results'
}
}
});
var xqComb = new Ext.form.ComboBox({
fieldLabel:"学期" ,
id:'xq',
labelWidth :50,
xtype: 'combobox',
editable : false,
allowBlank : false,
store: comboxStore,
queryMode : 'remote',
displayField: 'name',
valueField: 'value',
listeners: {
'change':function() {
xq = Ext.getCmp('xq').value;
xn = Ext.getCmp('xn').value;
Ext.apply(kcxzStore.proxy.extraParams, {
year: xn,
xueqi:xq,
});
kcxzStore.reload();
}
},
handler: function() {
}
});
xqComb.on('change', function(xqComb, newValue, oldValue) {
xq = Ext.getCmp('xq').value;
xn = Ext.getCmp('xn').value;
Ext.apply(kcxzStore.proxy.extraParams, {
year: xn,
xueqi:xq,
});
kcxzStore.load();
});
var kcxzComb = new Ext.form.ComboBox({
fieldLabel:"课程选择" ,
id:'kcxz',
labelWidth :60,
xtype: 'combobox',
editable : false,
allowBlank : false,
store: kcxzStore,
queryMode : 'remote',
displayField: 'kcmc',
valueField: 'kcdm',
listeners: {
'expand':function() {
xq = Ext.getCmp('xq').value;
xn = Ext.getCmp('xn').value;
Ext.apply(kcxzStore.proxy.extraParams, {
year: xn,
xueqi:xq,
});
}
},
handler: function() {
}
});
两个combox 第一个改变,想让第二个可以重新加载:
添加
queryMode : 'remote',