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

Deleting and Iterating

$
0
0

@chinenyem wrote:

Hello,

My main goal for this logic is to delete a node. I am deleting the node but getting a error in the console:

Uncaught Error: Collection was modified during iteration: Set(Part)#246
Perhaps you should iterate over a copy of the collection,
or you could collect items to be removed from the collection after the iteration.

This is my logic:

                    var savedNode;
                               for (var it = myDiagram.nodes.iterator; it.next(); ) {
                                   while (it.next()) {
                                       console.log(it.value)
                                       if (it.value instanceof go.Node ) {
                                           if (it.value === group){
                                                savedNode = it.value;
                                            }
                                        }
                                   }
                              }
                               myDiagram.remove(savedNode)
                               myDiagram.removeParts(savedNode.findLinksConnected())

What am I doing wrong?

Posts: 4

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 7069

Trending Articles