ztree 官网的中的 Search Nodes 例子中,所有菜单都是连着的,如果出现某个菜单下无子节点,那么在搜索时,此节点便不会自动展开,这里给出对应的增强版代码
成都创新互联主营苍溪网站建设的网络公司,主营网站建设方案,手机APP定制开发,苍溪h5成都微信小程序搭建,苍溪网站营销推广欢迎苍溪等地区企业咨询var setting = { data: { key: { title: "t" }, simpleData: { enable: true } }, view: { fontCss: getFontCss } }; var zNodes =[ { id:1, pId:0, name:"系统参数",open:true}, { id:11, pId:1, name:"通用参数"}, { id:111, pId:11, name:"状态A"}, { id:112, pId:11, name:"状态B"}, { id:12, pId:1, name:"日志"}, { id:121, pId:12, name:"操作类型"}, { id:122, pId:12, name:"操作结果"}, { id:1221, pId:122, name:"操作结果1"}, { id:1222, pId:122, name:"操作结果2"}, { id:12221, pId:1222, name:"操作结果21"}, { id:12222, pId:1222, name:"操作结果22"}, { id:12223, pId:1222, name:"操作结果23"}, { id:2, pId:0, name:"业务参数",open:true}, { id:21, pId:2, name:"工单类型"}, { id:22, pId:2, name:"监控类型"}, { id:23, pId:22, name:"监控子类型1"}, { id:24, pId:22, name:"监控子类型2"}, { id:25, pId:24, name:"监控子子类型1"}, { id:26, pId:24, name:"监控子子类型2"}, ]; var lastValue = '', nodeList = [], fontCss = {}; function searchNode(e) { var zTree = $.fn.zTree.getZTreeObj("treeDemo"); var value = $.trim(key.val()); lastValue = value; //zTree.expandAll(true); $('#treeDemo').html(""); $.fn.zTree.init($("#treeDemo"), setting, zNodes); if (value != "") { nodeList = zTree.getNodesByParamFuzzy("name", value); } else { nodeList = zTree.getNodesByParamFuzzy("name", "|||||||||||||||"); } updateNodes(true); } var parentNode = []; function updateNodes(highlight) { var zTree = $.fn.zTree.getZTreeObj("treeDemo"); parentNode = []; for( var i=0, l=nodeList.length; i另外有需要云服务器可以了解下创新互联建站www.cdcxhl.com,海内外云服务器15元起步,三天无理由+7*72小时售后在线,公司持有idc许可证,提供“云服务器、裸金属服务器、高防服务器、香港服务器、美国服务器、虚拟主机、免备案服务器”等云主机租用服务以及企业上云的综合解决方案,具有“安全稳定、简单易用、服务可用性高、性价比高”等特点与优势,专为企业上云打造定制,能够满足用户丰富、多元化的应用场景需求。
新闻标题:解决ztree搜索中多级菜单展示不全问题-创新互联
本文网址:http://njwzjz.com/article/cohcic.html