Quantcast
Channel: GoJS - Northwoods Software
Viewing all articles
Browse latest Browse all 7069

Delete a node with links

$
0
0

@chzh.austin wrote:

I know if there are links associated with a node, when deleting a node, the links will be removed as well.

I can see events from http://gojs.net/latest/samples/UpdateDemo.html, the links gets deleted first and then the node itself.

However, I realize the node itself deleted prior to the "linkDataArray" in addModelChangedListener. In this case, though I have oldValue, I can not use e.model.findNodeDataForKey(e.oldValue.to) to get NodeData.

if (e.modelChange === "linkDataArray") { // remove link
let fromNode = e.model.findNodeDataForKey(e.oldValue.from); // it will be null if deleting source node
let toNode = e.model.findNodeDataForKey(e.oldValue.to); // it will be null if deleting target node
}

Then, how can I get the node being deleted in addModelChangedListener? if (e.modelChange === "nodeDataArray") is hit after if (e.modelChange === "linkDataArray"). But the node itself gets deleted already even before if (e.modelChange === "linkDataArray").

Thanks,
Chuan

Posts: 2

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 7069

Trending Articles