Location in tree view

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())
  )));

Those two templates look OK to me.

It is somewhat less common to save and restore the locations of nodes in a tree if there is a TreeLayout as the Diagram.layout. Are you using a TreeLayout? However, that would not explain your error message. Do you get that error if you remove all of the Bindings on Node.location?

Yes, i use the tree layout.
If i remove all binding location i don’t have error.

Could you check all of the data to make sure that the “loc” property for each node data actually has a valid position information in it? I could imagine there being problems if the X or the Y included NaN or Infinity or some unparseable string.

Are there any other templates in use?

I know why in my first load of my diagram my json contains a property with loc = String.Empty.
thanks