extjs中 Ext.form.ComboBox如何在上一个Ext.form.ComboBox选择
extjs中Ext.form.ComboBox如何在上一个Ext.form.ComboBox选择后才绑定下一个Ext.form.ComboBox的数据。例如:选择省,绑定...
extjs中 Ext.form.ComboBox如何在上一个Ext.form.ComboBox选择后才绑定下一个Ext.form.ComboBox的数据。例如:选择省,绑定对应的市
展开
展开全部
{
xtype: "combo",
id: 'prov',
name: 'prov',
fieldLabel: '省份',
width: 280,
store: provincestore,
mode: 'local',
queryMode: 'local',
editable: false,
displayField: 'province',
valueField: 'province',
allowBlank: true,
enabled: true,
value: '',
listeners: {
change: function (mecombo) { // 监听省份的选择,变化时去修改市的combo的store
citystore.load({
params: {
subId: mecombo.getValue()
}
});
Ext.getCmp('city').setValue('');
}
},
selectOnFocus: true
},{
xtype: "combo",
id: 'city',
name: 'city',
fieldLabel: '城市',
width: 280,
store: citystore,
mode: 'local',
queryMode: 'local',
editable: false,
displayField: 'city',
valueField: 'city',
allowBlank: true,
enabled: true,
value: '',
listeners: {
change: function (mecombo) { // 监听市的选择变化,变化时去修改邮政编码栏的值
var record = citystore.getAt(citystore.find('city', mecombo.getValue()));
if (record) {
Ext.getCmp('Postcode').setValue(record.raw.zipcode);
}
}
}, {
id: 'Postcode',
name: 'Postcode',
xtype: 'textfield',
labelWidth: 90,
fieldLabel: '邮政编码',
width: 210
}
xtype: "combo",
id: 'prov',
name: 'prov',
fieldLabel: '省份',
width: 280,
store: provincestore,
mode: 'local',
queryMode: 'local',
editable: false,
displayField: 'province',
valueField: 'province',
allowBlank: true,
enabled: true,
value: '',
listeners: {
change: function (mecombo) { // 监听省份的选择,变化时去修改市的combo的store
citystore.load({
params: {
subId: mecombo.getValue()
}
});
Ext.getCmp('city').setValue('');
}
},
selectOnFocus: true
},{
xtype: "combo",
id: 'city',
name: 'city',
fieldLabel: '城市',
width: 280,
store: citystore,
mode: 'local',
queryMode: 'local',
editable: false,
displayField: 'city',
valueField: 'city',
allowBlank: true,
enabled: true,
value: '',
listeners: {
change: function (mecombo) { // 监听市的选择变化,变化时去修改邮政编码栏的值
var record = citystore.getAt(citystore.find('city', mecombo.getValue()));
if (record) {
Ext.getCmp('Postcode').setValue(record.raw.zipcode);
}
}
}, {
id: 'Postcode',
name: 'Postcode',
xtype: 'textfield',
labelWidth: 90,
fieldLabel: '邮政编码',
width: 210
}
追问
感谢你
追答
不客气
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询