Jquery EasyUI Combotree 初始化赋值
================================
©Copyright 蕃薯耀 2018年5月7日
http://fanshuyao.iteye.com/
Jquery EasyUI Combotree 初始化赋值是在事件onLoadSuccess后,
使用xxx.combotree("setValue", cmm_code_id_value);给插件赋值,如下所示:
onLoadSuccess : function(node, data){ var cmm_code_id_value = "${buildingNaming.cmm_code_id}"; if(cmm_code_id_value != null && $.trim(cmm_code_id_value) != ""){ var comboObj = $("#cmm_code_id"); comboObj.combotree("setValue", cmm_code_id_value); } }
完整代码如下:
$("#cmm_code_id").combotree({ multiple: true, required : true, checkbox : true, onlyLeafCheck : true,//只能叶子节点才能勾选 url : "${pageContext.request.contextPath}/xxxxx", onBeforeSelect : function(node){ $(this).tree("check", node.target);//控制点击文字时也能勾选 return false; }, onBeforeCheck : function(node, checked){ if(checked){//如果是勾选操作,则把之前选中的节点清除(不勾选) var nodes = $(this).tree("getChecked"); if(nodes.length > 0){ for(var i=0; i<nodes.length; i++){ $(this).tree("uncheck", nodes[i].target); } } } }, onLoadSuccess : function(node, data){ var cmm_code_id_value = "${buildingNaming.cmm_code_id}"; if(cmm_code_id_value != null && $.trim(cmm_code_id_value) != ""){ var comboObj = $("#cmm_code_id"); comboObj.combotree("setValue", cmm_code_id_value); } } });
扫描二维码关注公众号,回复:
192935 查看本文章
================================
©Copyright 蕃薯耀 2018年5月7日
http://fanshuyao.iteye.com/