Hi ,
I need to save the current location of my nodes in my diagram.
My diagram use a model like parent and childs.
[code]
myFullDiagram.model.nodeDataArray = JSON.parse(data.d);
myFullDiagram.model = new go.TreeModel(myFullDiagram.model.nodeDataArray);
[/code]When i want to save, i made this code:
myFullDiagram.model.toJson()
When i execute my code the first node has got the location but the others don’t have and i ve got an error JS
<span role=“presentation” =" -text ">Error in http://localhost:54937/Scripts/go.js line 14 : Error: Non-real measuredBounds has been set
I put for exemple 2 templates of nodes
myFullDiagram.nodeTemplateMap.add("Field",
GO(go.Node, go.Panel.Auto, { locationSpot: go.Spot.Center },
new go.Binding("location", "loc", go.Point.parse).makeTwoWay(go.Point.stringify),
new go.Binding("text", "key"),
GO(go.Shape, "RoundedRectangle",
{ fill: redgrad, portId: "", toLinkable: true }),
GO(go.Panel, go.Panel.Horizontal,
GO(go.Picture,
new go.Binding("source", "category", nodeTypeImage), { width: 20, height: 20 }),
GO(go.TextBlock, textStyle(),
{ text: 'Field' },
new go.Binding("text", "text").makeTwoWay())
)));
myFullDiagram.nodeTemplateMap.add("Reservoir",
GO(go.Node, go.Panel.Auto, { locationSpot: go.Spot.Center },
new go.Binding("location", "loc", go.Point.parse).makeTwoWay(go.Point.stringify),
new go.Binding("text", "key"),
GO(go.Shape, "RoundedRectangle",
{ fill: yellowgrad, portId: "", toLinkable: true }),
GO(go.Panel, go.Panel.Horizontal,
GO(go.Picture,
new go.Binding("source", "category", nodeTypeImage), { width: 20, height: 20 }),
GO(go.TextBlock, textStyle(),
{ text: 'Reservoir' },
new go.Binding("text", "text").makeTwoWay())
)));