0

Does anyone know how i can get the full Path, when I am clicking on a Node. I have seen a path option in the API, but I don't know exactly how to use it with the click event.

options: ITreeOptions = {
 actionMapping: {
  mouse: {
    dblClick: (tree, node, $event) => {

    }
  }
 }
}

1 Answer 1

2

Depending on what format you need you can build out the lineage/path yourself

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;
                }
            }
        }
    }
}
Sign up to request clarification or add additional context in comments.

1 Comment

this is exactly what I was looking for! lol If this was my question I would've given it a check mark! Thanks!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.