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

Way to bulk replace model data

$
0
0

@estesbubba wrote:

In our external properties when the user changes the name we do this in a transaction:

      this.diagram.removeModelChangedListener(this.handleModelChanged);
      model.nodeDataArray = nextProps.nodeDataArray;
      model.linkDataArray = nextProps.linkDataArray;
      this.diagram.addModelChangedListener(this.handleModelChanged);

It works but one side-effect is the selected node goes away plus I’m guessing it’s inefficient. I’m wondering if there is a way to apply the changes from nextProps.nodeDataArray to the current model.nodeDataArray? The only difference between the two is one node will have the name changed but in this code I don’t know which node that is. Any advice on a better way to handle this?

If not then I guess I can get the current selection, do the code above, then re-apply the selection.

Posts: 2

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 7069

Trending Articles