Higher node new link deletes current links of node

If two nodes have already links between them and then I try to add a link to the lower node then it removes the old link and adds only a new link with the new parent node.

Take a look to the gif:

Any ideas how to solve this?

Are you using a TreeModel? If so, the design of the model is such that any node can have at most one “parent” link. Use a GraphLinksModel instead.

If you are already using a GraphLinksModel, you’ll need to look at your code to see what’s going on.

Hey @walter,

I’m using treelLayout in my old app also and there it works. I can have multiple parents but ok the UI can me quite strange (that’s something that I can handle).
In the new version of the app I work (actually is a refactor) the same layout produce what you see above.

My code for now loos like this:

const relationsDiagram =
      MAKE(go.Diagram, diagramDiv,
          initialContentAlignment: go.Spot.Center, // center Diagram contents
          'undoManager.isEnabled': true, // enable Ctrl-Z to undo and Ctrl-Y to redo
          layout: MAKE(go.TreeLayout, // specify a Diagram.layout that arranges trees
                      angle: 90,
                      layerSpacing: 35

    // the template we defined earlier
    relationsDiagram.nodeTemplate =
      MAKE(go.Node, 'Horizontal',
          background: '#f2f1f0',
          locationSpot: go.Spot.Center,
          width: 250,
          fromLinkable: true,
          toLinkable: true,
          fromLinkableSelfNode: false,
          toLinkableSelfNode: false,
          fromLinkableDuplicates: false,
          toLinkableDuplicates: false,
          margin: 5,
          { margin: 5,
            width: 30,
            height: 30,
            source: '../../../assets/images/node.png'
          new go.Binding('source')
        MAKE(go.TextBlock, 'Default Text',
          { margin: 5,
            stroke: '#343434',
            font: '14px sans-serif'
          new go.Binding('text', 'name')

    // define a Link template that routes orthogonally, with no arrowhead
    relationsDiagram.linkTemplate =
          routing: go.Link.Orthogonal,
          corner: 5
        { strokeWidth: 1,
          stroke: '#343434'
      ); // the link shape

    let model = MAKE(go.TreeModel);
    model.nodeDataArray = items;

    relationsDiagram.model = model;

The Layout doesn’t matter. Well, it matters to how nodes are arranged, but not for this topic.

The Model determines the possible relationships – the graph that can be represented. A TreeModel cannot have multiple “parent” links.


@walter I have exactly the same issue with LayeredDigraphLayout & even with GridLayout… It’s not layout issue.

That’s exactly right – the Diagram.layout should not matter.

So? Is it an issue with the library or you see something wrong from my part?

As I suggested earlier:

I haven’t realise it sorry.

Thanks for the help.