ztree连接数据库问题总结
1.获取ztree根节点的方法
function getRoot() {
var treeObj = $.fn.zTree.getZTreeObj("tree-div");
//返回一个根节点
var node = treeObj.getNodesByFilter(function (node) { return node.level == 0 }, true);
}
2.获取根节点集合的方法
function getRoots() {
var treeObj = $.fn.zTree.getZTreeObj("tree-div");
//返回根节点集合
var nodes = treeObj.getNodesByFilter(function (node) { return node.level == 0 });
}
3.获取点击节点的信息
function clickNode(){
var clickNode = treeObj.getselectedNodes();
}
获取点击的节点里面的id/name...:
clickNode[0]["id"];
clickNode[0]["name"];
......