//ztree数据回显$(document).ready(function(){ //加载树 $.fn.zTree.init($("#treeDemo2"), setting2, zNodes2); //获取到树 var zTree_Menu = $.fn.zTree.getZTreeObj("treeDemo2"); //获取将要回显的值,即树节点名称 var name = ‘${weatherEleMap.crops_name}‘; var nodes = zTree_Menu.transformToArray(zTree_Menu.getNodes()); if (nodes.length>0) { for(var i=0;i<nodes.length;i++){ if(name.indexOf(nodes[i].name) >= 0){ nodes[i].checked = true; zTree_Menu.updateNode(nodes[i]); } } } });
时间: 2024-11-11 09:35:30