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

Transactions about modifying node data

$
0
0

@kingo wrote:

function updateProprerty() {
   myDiagram.selection.each(function(node) {
       for (var para in node.data) { 
         var nodeData = node.data;
         var oldValue = node.data[para];
         var newValue = $("#p_" + para).val();
         if (para != "isgroupnode"&&oldValue !=newValue) {
            myDiagram.startTransaction("update nodeProperty");
            myDiagram.model.setDataProperty(nodeData, para, newValue);
            myDiagram.commitTransaction("update nodeProperty");
          }
       }
   });
}

As shown in the code, I want to modify the datum for the selected node.
If you use this method on the same Node several times, only the first time you successfully modify the properties of the node in the myDiagram.
How can I improve the method so that changes in nodes can be timely reflected in the myDiagram?

Posts: 3

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 6969