提交 6864aad3 编写于 作者: Z ztree

fixed: singlepath

上级 9d575429
此差异已折叠。
...@@ -71,8 +71,25 @@ ...@@ -71,8 +71,25 @@
} }
function singlePath(newNode) { function singlePath(newNode) {
if (newNode === curExpandNode) return; if (newNode === curExpandNode) return;
if (curExpandNode && curExpandNode.open==true) {
var zTree = $.fn.zTree.getZTreeObj("treeDemo"); var zTree = $.fn.zTree.getZTreeObj("treeDemo"),
rootNodes, tmpRoot, tmpTId, i, j, n;
if (!curExpandNode) { //very first expand: check if roots are already opened
//by default and close if not my root
tmpRoot = newNode; //just in case, don't break any original code
while (tmpRoot) {
tmpTId = tmpRoot.tId; //will be my root when while() ends
tmpRoot = tmpRoot.getParentNode();
}
rootNodes = zTree.getNodes();
for (i=0, j=rootNodes.length; i<j; i++) {
n = rootNodes[i];
if (n.tId != tmpTId) {
zTree.expandNode(n, false);
}
}
} else if (curExpandNode && curExpandNode.open) {
if (newNode.parentTId === curExpandNode.parentTId) { if (newNode.parentTId === curExpandNode.parentTId) {
zTree.expandNode(curExpandNode, false); zTree.expandNode(curExpandNode, false);
} else { } else {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册