easyUI combobox onChange、onSelect事件等

easyUI中的onChange事件 与JQuery有所区别,好好看文档,

easyUI combobox onChange、onSelect事件等_第1张图片

1、onChange

 

2、setValue,getValue

function setvalue(){
	var ruleAppId= $("#ruleAppId").val();
	var weChatDept =$('#weChatDept').combobox('getValue');
	//alert(weChatDept);
	var index= weChatDept.indexOf('|',0);
	var weChatDeptCode=weChatDept.substring(index+1,weChatDept.length);
	$.messager.prompt('输入店长信息','姓名1-证件号码1;姓名2-证件号码2',function(v){
	if (v){
		$.ajax({
			url : "inputStoreManager.do",
			type : "post",
			data :{
				"ruleAppId" : ruleAppId,
				"managerData" :v,
				"weChatDeptCode":weChatDeptCode
			},
			success : function(data) {
				if(data =='false')
				{
					$.messager.alert('提示', '店长录入格式有误!','info');
					return false
				}
				else
				{
        			var tempdata,json;
      					 tempdata = [];
       				$("#manager").combobox("clear");
       				$('#manager').combobox("options", {valueField: 'id',textField: 'text' });
       				json = $.parseJSON(data);
       				 $("#manager").combobox({
       						valueField: "id",
        		                textField: "text",
        		                data: json
       				 });
					//$('#manager').combobox('setValue',v);
				}
			}
		});
		
	}
		
	});
}

后台处理 json字符串

protected  String getManagerStringByDeptCode(String projectName ,String Ccode,
			String dimAttr,String weChatDeptCode) throws ServiceException  {
		List result = storeManagerService.getWeChatManagerByDeptCde(projectName,Ccode,weChatDeptCode);
		dimAttr = "appBase.supervisorCode";
		//返回数组信息 0:dimAttr 1:name 2:id
		StringBuffer sb = new StringBuffer();
		sb.append("[");
			sb.append("{\"id\":\"");
			sb.append(dimAttr);
			sb.append("|");
			sb.append("ALL");
			sb.append("\",\"text\":\"");
			sb.append("ALL");
			sb.append("\"");
			sb.append("}");
			sb.append(",");
		for (Code code : result) {
			sb.append("{\"id\":\"");
			sb.append(dimAttr);
			sb.append("|");
			sb.append(code.getId());
			sb.append("\",\"text\":\"");
			sb.append(code.getId());
			sb.append("-");
			sb.append(code.getName());
			sb.append("\"");
			sb.append("}");
			sb.append(",");
		}
		sb.deleteCharAt(sb.length() - 1);
		sb.append("]");
		return sb.toString();
	}

JQuery前端遍历二维数组

$.ajax({
	url : "xxx",
	type : "post",
	data : {
	"param" : param
	},
	success : function(data) {
		for(var key in data){
		//第一层数组
		for(var i in data[key]){
			alert(data[key][i]);//第二层
			}
		}
	}
	})
                              


easyUI参考文档 http://pan.baidu.com/s/1jHVlzlc

你可能感兴趣的:(easyUI combobox onChange、onSelect事件等)