What user selected node links are being deleted?


I am trying to figure out how to get information during the SelectionDeleting” event to know which link(s) a user is deleting. In other words, when a user clicks a link or links in between nodes and hits the delete button, how do i find out which links the user is deleting? I have provide an example of the “SelectionDeleting” event below.

<span =“Apple-tab-span” style=“white-space:pre”> //how do i find out what the user is deleting here

<span =“Apple-tab-span” style=“white-space:pre”> }


Try e.diagram.selection

Here is what I do:

            iter = diagram.selection.iterator;
            while (iter.next()) {
                if (iter.value instanceof go.Node) {
                    diagramModel[this.nodesStoreName].remove(me.getNodeModel(iter.value, diagramModel));
                else if (iter.value instanceof go.Link) {
                    diagramModel[this.transStoreName].remove(me.getTranModel(iter.value, diagramModel));

Or you could write it as:

for (var iter = diagram.selection.iterator; iter.next(); ) {
    var part = iter.value;
    if (part instanceof go.Node) {
        if (part.data.xyz == 17) { ... }

Remember not to modify the diagram.selection collection while you are iterating over it.

This was perfect! Thanks guys!