TreeMapping :: fromLinkable for more than 2 groups

In GoJs, Could you please give us the soultion for tree mapping.

fromLinkable how to allow if its more than 2 groups. Its not allowing to liink… Link is not enabled to connect. Could you please help ?

const fromLinkMethod = (k) => {
  return k ==='Source';
const toLinkMethod = (k) => {
  return k ==='Destination';
const fromPVLinkMethod = (k) => {
  return k === 'Source1';
new go.Binding('fromLinkable', 'group', fromLinkMethod ),

new go.Binding('toLinkable', 'group', toLinkMethod ),

new go.Binding('fromLinkable', 'group', fromPVLinkMethod ),

You do not want to use any of that code. All of the link validation is implemented in the Tree Mapper sample by the checkLink function.

Please read GoJS Validation -- Northwoods Software.

Its not a validation. I need to allow the link from the one more group for the tree mapping. Initially have a group -1 and -2 for tree mapping right need to allow the map from one more group like -3

GraphObject.fromLinkable and toLinkable are also part of the standard link validation mechanisms.

There are a bunch of properties that affect the ability for users to draw new links or reconnect existing ones. Everything is described in that Introduction page about Validation.

Its not releated to the validation checkLink because there is no linkable for from side. It allows only one group in fromLinkable

If fromLinkable assign more than one group… it works for only one group. There is no option to link for the another group

Link option not available in another group

If you can implement Bindings on fromLinkable and toLinkable, that’s good. But I’m saying that if the conditions are more complicated than can be expressed in a data binding, the most general solution is to implement a linkValidation predicate, either in addition to fromLinkable and toLinkable or in place of those properties.

The way you have defined your Bindings doesn’t make sense. You have two Bindings with the target “fromLinkable” and the source “group”. Depending on the order in which the bindings are evaluated, it’s only the last one that determines whether the fromLinkable property is true or false. Why didn’t you just define the conversion function the following way?

new go.Binding("fromLinkable", "group", function(k) { return k === "Source" || k === "Source1"; }),
1 Like