Accessing new node data


I’m working with a local JSON file in my system which contains nodeDataArray and linkDataArray .
I can add new nodes to diagram with simple copy-paste. But when I do so, I, obviously, can’t see the new node’s data in the JSON I’m working with.

When I add a new node with using copy-paste, I need to see that new node’s data return to JSON. Is that possible?


Normally one can save a diagram by saving its model. Saving a model normally means calling the Model.toJson method and then saving the resulting string somehow.

That last step is normally accomplished by sending a request to the web server. That is what you need to implement. There are many ways to do so, none of which involve GoJS.

I’m sorry I didn’t quite understand what you mean.

Without the saving as JSON step, how can I access to the duplicate (the one created by copy-paste) node’s data?

Thanks again.

In general, after the paste has happened, the new Parts will be selected, so you can look at the Diagram.selection collection.

You could implement a “ClipboardPasted” DiagramEvent listener.