Jquery EasyUI Combotree initialization assignment
================================
©Copyright Sweet Potato Yao May 7, 2018
http://fanshuyao.iteye.com/
The initial assignment of Jquery EasyUI Combotree is after the event onLoadSuccess,
Use xxx.combotree("setValue", cmm_code_id_value); to assign a value to the plugin, as follows:
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); } }
The complete code is as follows:
$("#cmm_code_id").combotree({ multiple: true, required : true, checkbox : true, onlyLeafCheck : true,//Only leaf nodes can be checked url : "${pageContext.request.contextPath}/xxxxx", onBeforeSelect : function(node){ $(this).tree("check", node.target);//Control can also check when clicking on text return false; }, onBeforeCheck : function(node, checked){ if(checked){//If it is a check operation, clear the previously selected node (uncheck it) 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); } } });
================================
©Copyright Sweet Potato Yao May 7, 2018
http://fanshuyao.iteye.com/