Thread ID: |
Created: |
Updated: |
Platform: |
Replies: |
141431 | Dec 11,2018 02:38 PM UTC | Dec 18,2018 05:17 AM UTC | Angular - EJ 2 | 3 |
![]() |
Tags: Treeview |
public parentNodes: any = [];
//Node Selected Event for TreeView component
public onNodeSelected(args: NodeSelectEventArgs): void {
this.parentNodes.push(args.node)
this.findParentNodes(args.node);
let fullpath = "";
for(let i = this.parentNodes.length - 1; i >= 0; --i) {
//using getNode method to get the node text
var data = this.tree.getNode(this.parentNodes[i]);
fullpath = fullpath + data.text;
if (i != 0) {
fullpath = fullpath + '\\';
}
}
alert(fullpath);
this.parentNodes = [];
}
//collect the parent nodes for currently selected node
public findParentNodes(node: HTMLElement) {
let parent: HTMLElement = node.parentElement.parentElement;
if (parent.classList.contains("e-list-item")) {
this.parentNodes.push(parent);
this.findParentNodes(parent);
}
} |
This post will be permanently deleted. Are you sure you want to continue?
Sorry, An error occured while processing your request. Please try again later.
This page will automatically be redirected to the sign-in page in 10 seconds.