combobox使用

页面代码:
var yjjgCombo = new Ext.form.ComboBox( {
		fieldLabel : '研究机构',
		store : new Ext.data.JsonStore( {
			idProperty : 'ID',
			url : 'yjjg.do',
			root : 'data',
			fields : [ 'ID', 'TEXT' ]
		}),
		hiddenName : 'YJJG',
		displayField : 'TEXT',
		valueField : 'ID',
		typeAhead : true,
		mode : 'remote',
		emptyText : '请选择',
		triggerAction : 'all',
		editable : false,
		anchor : '95%',
		selectOnFocus : true,
		autoLoad : false
	});

服务器端代码:
// 研究机构下拉列表
	public ModelAndView yjjg(HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		List data = yjbgDao.queryYjjg();
		Map resultMap = new HashMap();
		resultMap.put(Constants.JSON_SUCCESS, Boolean.TRUE);
		resultMap.put(Constants.JSON_DATA, data);
		return new ModelAndView(Constants.JSON_VIEW, Constants.JSON_CLEAN,
				resultMap);
	}

交互的json:
{"data":[{"ID":12089,"TEXT":"爱建证券"},{"ID":62901,"TEXT":"安邦集团"}],"success":true}

你可能感兴趣的:(JavaScript,java,json,ext)