http://www.sencha.com/forum/showthread.php?153490-Combo-Box-Store-Loading
一级下拉框代码:
Ext.define('type_combo', { extend : 'Ext.form.field.ComboBox', fieldLabel : '类型', editable : false, queryMode : 'local', store: new Ext.data.Store({ proxy: { type : 'ajax', url : action_url }, fields : ['abbr', 'name'], autoLoad : true }), valueField : 'abbr', displayField : 'name', listeners : { select : function(combo,records,options){ Ext.getCmp('ds_combo').clearValue(); var store = Ext.data.StoreManager.lookup('ds_store'); store.load({ params:{ id : combo.getValue() } }); } } });
二级下拉框代码:
Ext.define('data_combo', { extend: 'Ext.form.field.ComboBox', id:'ds_combo', fieldLabel: '名称', editable:false, queryMode:'local', store: new Ext.data.Store({ storeId:'ds_store', proxy: { type: 'ajax', url : action_url }, fields: ['abbr', 'name'], autoLoad:true }), valueField:'abbr', displayField:'name' });
@ResponseBody public JSONArray getData(HttpServletRequest request) { String idStr = request.getParameter("id"); ....... JSONArray list = new JSONArray(); ....... JSONObject obj = new JSONObject(); obj.put("abbr", da.getId()); obj.put("name", da.getName()); list.add(obj); ....... return list; }