linkTemplate not being applied whith drag/drop nod

Hello,

I’m working on a project that requires the diagram to be user-built by drag/dropping nodes from a palette onto the diagram, and then the user will manually connect up ports between the nodes. I have all of that working, but the linkTemplate I want never seems to be applied.

This is the template I have right now.

this.diagram.linkTemplate =
$go(go.Link,
{
routing: go.Link.AvoidsNodes,
curve: go.Link.JumpOver,
corner: 4,
relinkableFrom: true, relinkableTo: true
},
$go(go.Shape),
$go(go.Shape, { toArrow: “Standard” })
);

It’s very simple, but whenever I draw the links, the paths just go over nodes and other paths whenever it wants.

Any insights?

Thanks!

  • Tim

That looks OK to me. But this is JavaScript, so the slightest error can go undetected at the time that it occurs.

First, are there any warnings or errors in the console log?

Second, is the value of “this.diagram” really a go.Diagram? And if so, is it really the same diagram that the user is looking at?

Third, are the nodes very close to each other? If there isn’t enough room between them for links to be routed to avoid nodes, then it just goes “through” them.

There aren’t any errors or warnings, I would have a better idea of where to look myself then.

this.diagram is the go.Diagram, I use it all over the place to and everything else works well.

I can move the nodes to opposite sides of the diagram, and the links still won’t route properly.

Well, I’m not sure what I did…but it works now. :/ Thanks.