Function of get&cancel nodes in z-tree

onClick

获取选中的节点:

var zTreeObj = $.fn.zTree.getZTreeObj("taskTreeId");
var nodes = zTreeObj.getSelectedNodes();

取消选中的节点:

zTreeObj.cancelSelectedNode();

onCheck

获取选中的节点:

var treeObj = $.fn.zTree.getZTreeObj("deviceTreeId");
var nodes = treeObj.getCheckedNodes(true);

取消选中的节点:

treeObj.checkAllNodes(false);

全选按钮的功能

选中所有节点:

var devTreeObj = $.fn.zTree.getZTreeObj("deviceTreeId");
var checkStatus = $("#selAllId").is(":checked");
devTreeObj.checkAllNodes(checkStatus);
var nodeChecked = devTreeObj.getCheckedNodes(true);//该方法获取的勾选节点包括半选节点

你可能感兴趣的:(Function of get&cancel nodes in z-tree)