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

Removing is invalid

$
0
0

@3q wrote:

Q1:

 var sketchNode = myDiagram.findNodesByExample({ key: "sketch" });
 console.log("sketchNode.count:"+sketchNode.count);//if the sketchNode.count is 2.
 var it = sketchNode.iterator;
 while (it.next()) {
      console.log(it.key + "--- " + it.value);
 }
myDiagram_${diagramId}_${diagramType}.startTransaction("removesketchNodes");
myDiagram_${diagramId}_${diagramType}.model.removeNodeDataCollection(sketchNode);//removing is invalid ,why???
myDiagram_${diagramId}_${diagramType}.commitTransaction("removesketchNodes");

the results of console.log();

First, I want to find the nodes that it's key is "sketch" on the myDiagram.
Then,I want to remove the nodes on the myDiagram.
What Would l Do?

Q2:

var nodeLength = myDiagram.model.nodeDataArray.length;
			console.log("nodeLength:"+nodeLength);
			for(var k=0;k<nodeLength;k++){
				var sketchNode = myDiagram.model.nodeDataArray[k].key;
				if(sketchNode=="sketch"){
					var nodedata = myDiagram.model.nodeDataArray[k];
					myDiagram.startTransaction("removesketchNodes");
					myDiagram.model.removeNodeData(nodedata);
					myDiagram.commitTransaction("removesketchNodes");
				}
			}


When I delete it one by one, and make a mistake, what is the reason?

Posts: 2

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 7069

Trending Articles