Permalink
Browse files

feat: 添加getPath方法,与最新的ztree版本保持一致

  • Loading branch information...
LiuYueKai committed May 16, 2017
1 parent c48b855 commit b78ab0e2c3d658b477d468cdb652d9a29c8c9ab6
Showing with 19 additions and 0 deletions.
  1. +19 −0 src/js/treeComp.js
View
@@ -307,6 +307,9 @@
n.getParentNode = function() {return data.getNodeCache(setting, n.parentTId);};
n.getPreNode = function() {return data.getPreNode(setting, n);};
n.getNextNode = function() {return data.getNextNode(setting, n);};
n.getPath = function () {
return data.getNodePath(setting, n);
};
n.isAjaxing = false;
data.fixPIdKeyValue(setting, n);
},
@@ -467,6 +470,22 @@
var nameKey = setting.data.key.name;
return "" + node[nameKey];
},
getNodePath: function (setting, node) {
if (!node) return null;
var path;
if (node.parentTId) {
path = node.getParentNode().getPath();
} else {
path = [];
}
if (path) {
path.push(node);
}
return path;
},
getNodeTitle: function(setting, node) {
var t = setting.data.key.title === "" ? setting.data.key.name : setting.data.key.title;
return "" + node[t];

0 comments on commit b78ab0e

Please sign in to comment.