ExtJs下拉联动控制选择

//示例frompanel中有三个下拉框,根据第一个下拉选择的数据自动选择其他两个 { columnWidth: 1, layout: 'form', border: false, items: [ { id: 'ServiceHall1', name: 'ServiceHall1', xtype: 'combo', hideOnSelect: false, readOnly: false, editable: true, fieldLabel: "服务站1", store: store1, typeAhead: true, valueField: 'ServiceHall1', displayField: 'ServiceHall1', mode: 'local', triggerAction: 'all', emptyText: '按东西区分公司...', allowBlank: true, blankText: '请选择东西区服务站', selectOnFocus: true, readOnly: false, listeners:{ select : function(combo, record, index){ //alert(combo.value); var dsTmp = new Ext.data.JsonStore({ url: "Service/Innvoice.asmx/ShowCompanyAgent", baseParams: {serviceHall1: combo.value}, fields: ['company', 'agent'] }); var selCompany,selAgent; dsTmp.load(); dsTmp.on("load", function() { //tmp = ds.data.items[0].data.age; //这个也可以 selCompany = dsTmp.getAt(0).get("company"); selAgent = dsTmp.getAt(0).get("agent"); Ext.getCmp("company").setValue(selCompany); Ext.getCmp("agent").setValue(selAgent); }); } } }]}, { columnWidth: 1, layout: 'form', border: false, items: [ new Ext.form.ComboBox({ name: "company", id: "company", fieldLabel: "公司", store: ['东区分公司', '西区分公司'], typeAhead: true, mode: 'local', triggerAction: 'all', emptyText: '请选择...', selectOnFocus: true, allowBlank: true, blankText: '请选择分公司', anchor: '90%' }) ] }, { columnWidth: 1, layout: 'form', border: false, items: [ new Ext.form.ComboBox({ name: "agent", id: "agent", fieldLabel: "代理商", store: ['代理商1', '代理商2','代理商3','代理商4','代理商5'], typeAhead: true, mode: 'local', triggerAction: 'all', emptyText: '请选择...', selectOnFocus: true, allowBlank: true, blankText: '请选择代理商', anchor: '90%' }) ] }

 

webservice中ShowCompanyAgent示例

 

  public void ShowCompanyAgent(string serviceHall1) { string json = string.Empty; json = "{/"company/":/"东区分公司/",/"agent/":/"信大公司/"}"; json = "[" + json + "]"; System.Web.HttpContext.Current.Response.Write(json); }

 

 

你可能感兴趣的:(json,function,webservice,layout,ExtJs,border)