Exclude extra settings from Diagram json

Hi

I'm saving diagram json structure for each entity using saveDiagram function to upload it any time.

When I add new stuff user handles, or context menu I need to create the new entity, because diagram setting are also saved in JSON and it's very unhandy.

It there any option just to save nodes, connectors, their relations and positions only?

1 Reply 1 reply marked as answer

GG Gowtham Gunashekar Syncfusion Team March 30, 2021 12:54 PM UTC

Hi Alex, 
 
We have option to save the entire diagram into JSON using the saveDiagram API, and we don’t have option to save a specific properties like the nodes and connector etc. however you can load the entire diagram using the loadDiagram API and after load the diagram we can the change the userHandle and other diagram property at runtime. We have added a sample link to demonstrate how to change the userHandle after loaded a diagram. 
 
Code snippet: 
var savedData = diagramInstance.saveDiagram(); 
diagramInstance.loadDiagram(savedData); 
diagramInstance.selectedItems.userHandles[0].pathData="M540.3643,137.9336L546.7973,159.7016L570.3633,159.7296L550.7723,171 
.9366L558.9053,194.9966L540.3643,179.4996L521.8223,194.9966L529.9553,171.9366L510.3633,159.7296L533.9313,159.7016L540.3643,137.9336z"; 
diagramInstance.selectedItems.userHandles[0].backgroundColor ="yellow"; 
diagramInstance.selectedItems.userHandles[0].pathColor='red'; 
diagramInstance.dataBind(); 
diagramInstance.select([diagramInstance.nodes[0]]); 
 
 
Regards, 
Gowtham 
 


Marked as answer
Loader.
Up arrow icon