How activate links relinking?

I’d like to make possible for the user to change relationship between nodes relinking links like in the OrgChart sample. I set the following in my link template
relinkableFrom: true, relinkableTo: true

Now, when I click on a link, I see the little handles at the beginning and at the end of the link and I can drag them around but when I drop it on a different node, nothing happen. What else I need to have relinking feature working? I am using GraphLinksModel with a SideTreeLayout.


It sounds like drawing such links by the user is not permitted for some reason. Perhaps you have set Diagram.validCycle?

Read more at GoJS Validation -- Northwoods Software.

Initially I didn’t set it and now I set to go.Diagram.CycleAll but nothing has changed. I set also fromLinkable:true and toLinkable:true in my node template.

I still think it is a link validation problem. But I cannot explain it without a lot more information.

See for example the Org Chart Editor sample, which does allow some cases of relinking: Org Chart Editor. Notice that it does set Diagram.validCycle, which is why some relinkings are not valid and thus not permitted.

ok, I found the problem! :-) I was been confused by this phrase in the documentation:

You can certainly declare a Panel to have GraphObject.fromLinkable or GraphObject.toLinkable be true. This will cause all elements inside that panel to behave as part of the port, including starting a linking operation. Sometimes you will want to make the whole Node linkable.If you still want the user to be able to select and drag the node, you will need to make some easy-to-click elements not-“linkable” within the node

So I set fromLinkable and toLinkable in the first big panel inside my node.

Now, that I moved the “Linkable” properties at the Node level, the top level, linking is working as expected.
To be honest, it is still not completely clear to me why setting linkeable in the inner panel didn’t work…

Thanks for you support.

Yes, you need to set those fromLinkable and toLinkable properties to true on the port.

Additionally you might want to set them to false on some objects inside the port, if you don’t want the LinkingTool to start operating when dragging those objects.