有人知道当我点击一个节点时,如何获得完整的路径吗?我在API中看到了路径选项,但我不知道如何在单击事件中使用它。
options: ITreeOptions = {
actionMapping: {
mouse: {
dblClick: (tree, node, $event) => {
}
}
}
}发布于 2018-01-05 23:23:36
根据您需要的格式,您可以自己构建谱系/路径
options: ITreeOptions = {
actionMapping: {
mouse: {
dblClick: (tree, node, $event) => {
const lineage = [];
// add clicked node as first item
lineage.push(node.data);
// grab parent of clicked node
let parent = node.parent;
// loop through parents until the root of the tree is reached
while(parent !== null){
lineage.push(parent.data);
parent = parent.parent;
}
}
}
}
}https://stackoverflow.com/questions/48114561
复制相似问题