We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Can get node fullPath with nodeClick?

Thread ID:





141431 Dec 11,2018 02:38 PM UTC Dec 18,2018 05:17 AM UTC Angular - EJ 2 3
Tags: Treeview
Jon Andoni
Asked On December 11, 2018 02:38 PM UTC


I´m trying to get the fullnode path of a node; for example:

     1.1. Second_Level_1
     1.2. Second_Level_2
          1.2.1 Third_Level_1
     1.3. Second_Level_3

Imagine that I click on 1.2.1, what I want to get is the path: First_Level/Second_Level_2/Third_level_1

Can I do this?

Thank your very much.

Christopher Issac Sunder K [Syncfusion]
Replied On December 12, 2018 12:33 PM UTC

Hi Jon Andoni, 

Thank you for contacting Syncfusion support. 

In our TreeView component, we have provided the option to get the node data for specified tree node element. You can use this method to get the full path for corresponding node click action. Please check the below code logic. 

public parentNodes: any = []; 
//Node Selected Event for TreeView component 
public onNodeSelected(args: NodeSelectEventArgs): void { 
    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 + '\\'; 
    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")) { 

Please let us know if you require any further assistance. 


Jon Andoni
Replied On December 17, 2018 12:54 PM UTC


It works,

Thanks Christo.

Christopher Issac Sunder K [Syncfusion]
Replied On December 18, 2018 05:17 AM UTC

Hi Jon Andoni, 

We are glad to hear that the issue has been resolved at your end. Please let us know if you require further assistance. 



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.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon