时间:2021-07-01 10:21:17 帮助过:61人阅读
var setting = { check: { enable: true }, data: { simpleData: { enable: true } }, callback: { beforeClick: function (treeId, treeNode) { var zTree = $.fn.zTree.getZTreeObj("treeDemo"); if (treeNode.isParent) { //zTree.expandNode(treeNode); return false; } else { treeNode.checked = true; return true; } } } };
好像没这个功能得!
LZ !研究出来了。测试可以!你试试
function zTreeOnClick(event, treeId, treeNode) { var treeObj = $.fn.zTree.getZTreeObj("treeDemo"); var node = treeObj.getNodeByTId(treeNode.tId); treeObj.checkNode(node, true, true);} var setting = { check: { enable: true }, data: { simpleData: { enable: true } }, callback: { onClick: zTreeOnClick } };
LZ !研究出来了。测试可以!你试试
function zTreeOnClick(event, treeId, treeNode) { var treeObj = $.fn.zTree.getZTreeObj("treeDemo"); var node = treeObj.getNodeByTId(treeNode.tId); treeObj.checkNode(node, true, true);} var setting = { check: { enable: true }, data: { simpleData: { enable: true } }, callback: { onClick: zTreeOnClick } };
Tid 是自动生成的吧!同理你也可以用ID当做参数把节点查出来就可以了!获取节点的方法有几个,你可以试试
LZ !研究出来了。测试可以!你试试
function zTreeOnClick(event, treeId, treeNode) { var treeObj = $.fn.zTree.getZTreeObj("treeDemo"); var node = treeObj.getNodeByTId(treeNode.tId); treeObj.checkNode(node, true, true);} var setting = { check: { enable: true }, data: { simpleData: { enable: true } }, callback: { onClick: zTreeOnClick } };