I want to create a node outside of myDiagram(the grid) Canvas in order to distinguish it as the Title for the diagram. And in addition the value of the node should become a part of the JSON created for the diagram.
Is there any way to do that in gojs?
August 29, 2017, 11:15am
Save the information in the
Model | GoJS API Object.
For this that node must be a part of diagram, right ?
But i want it outside of my diagram or usually as an HTML element and bind to JSON. Any example for such case ?
August 29, 2017, 1:28pm
Information stored on the
Model.modelData object is not associated with any Part in the Diagram. It is still there even if there are no Nodes at all.
Hi, i made an input box outside of the canvas.
And i tried binding it with my diagram
wfname = document.getElementById(‘title’).value;
_ myDiagram.model.modelData = wfname.model.toJson();_
which throws an error:
Cannot read property ‘toJson’ of undefined
at init (flowchartcheck.html:795)
at onload (flowchartcheck.html:1076)
How can i resolve it ?
August 30, 2017, 10:14am
In a blur event handler on the text input, call
var model = myDiagram.model;
model.setDataProperty(model.modelData, "title", ...the new text string...);