DiagramBuilder.toJSON()
returns a JSON representation of the diagram. How can I use this JSON object to create a new DiagramBuilder
with the same diagram?
How can I create a AlloyUI DiagramBuilder from the JSON returned by DiagramBuilder.toJSON()?
426 views Asked by stiemannkj1 At
2
There are 2 answers
0
On
You can pass the result of DiagramBuilder.toJSON() to the fields parameter of the DiagramBuilder. See the example below.
jsonData = DiagramBuilder.toJSON();
new Y.DiagramBuilder({
fields : jsonData.nodes,
availableFields: availableFields,
boundingBox: '#diagram-builder-container',
srcNode: '#diagramBuilder',
render: true
});
You can pass the
jsonData.nodes
to thefields
attribute of theDiagramBuilder
: