1.獲取ztree根節點的方法node
function getRoot() {
var treeObj = $.fn.zTree.getZTreeObj("tree-div");
//返回一個根節點
var node = treeObj.getNodesByFilter(function (node) { return node.level == 0 }, true);
}get
2.獲取根節點集合的方法io
function getRoots() {
var treeObj = $.fn.zTree.getZTreeObj("tree-div");
//返回根節點集合
var nodes = treeObj.getNodesByFilter(function (node) { return node.level == 0 });
}function
3.獲取點擊節點的信息cli
function clickNode(){select
var clickNode = treeObj.getselectedNodes();方法
}集合
獲取點擊的節點裏面的id/name...:di
clickNode[0]["id"];return
clickNode[0]["name"];
......