0

I am making a diagram using GoJS, I am allowing textedit for nodes and in a later time making new nodes and editing nodes and links

        window.diagram =
$(go.Diagram, "myDiagramDiv",
{
  initialContentAlignment: go.Spot.Center, // center Diagram contents
  "undoManager.isEnabled": true, // enable Ctrl-Z to undo and Ctrl-Y to redo
});
           // the node template describes how each Node should be constructed
          diagram.nodeTemplate =
            $(go.Node, "Auto",  // the Shape automatically fits around the TextBlock
            $(go.Shape, "RoundedRectangle",  // use this kind of figure for the Shape
             // bind Shape.fill to Node.data.color
             new go.Binding("fill", "color")),
            $(go.TextBlock,
            { margin: 3 ,// some room around the text
               editable: true },  // permet de le modifier
            // bind TextBlock.text to Node.data.key
            new go.Binding("text", "key")),
         );
          diagram.linkTemplate =
            $(go.Link,
            $(go.Shape),                           // this is the link shape (the line)
            $(go.Shape, { toArrow: "Standard" }),  // this is an arrowhead
            $(go.TextBlock,                        // this is a Link label
            new go.Binding("text", "text"))
        );

I can get the objects usin

    window.diagram.GraphLinksModel.nodeDataArray

but i get the same object array even after editing the diagram Any help getting the nodeDataArray and linkDataArray after edit ?

1 Answers1

0

I found the answer, I should add a function while bindging

    $(go.TextBlock,
            { margin: 3 ,// some room around the text
               editable: true}, 
            // bind TextBlock.text to Node.data.key
            new go.Binding("text", "key").makeTwoWay()), // makeTwoWayis what i neededd
         );