Alex Tokarev
Alex Tokarev

Reputation: 11

Get parent node of node go.js

There is a scheme in GO.JS which there are two nodes that have the same parent:

preview

I want to get the key of the node and the key of the parent node on double click on this node. There are no problems with obtaining the key of the node itself.

myDiagram.addDiagramListener("ObjectDoubleClicked", function (ev) {
    console.log(ev.subject.part.nb.key);
});

How to get the same format the key of the parent node from which the node comes from, which was double-clicked?

Upvotes: 0

Views: 123

Answers (1)

Alex Tokarev
Alex Tokarev

Reputation: 11

        let currentNodeKey = ev.subject.part.key;
        let parentNodeKey = ev.subject.part.findTreeParentNode().key;

Upvotes: 1

Related Questions