How add unique key to links

the diagram adds key to nodes automatically how to add the same in link array in graph link model

myDiagram.model =
Go(go.GraphLinksModel, {
“nodeDataArray”: [],
“linkDataArray”: []


Set GraphLinksModel.linkKeyProperty,, to the name of the property you want to use on the link data to remember the key value.

It’s very similar to

is there a built in function that can get the link on basis of that key i set?
like findnodeforkey

As long as your link keys don’t overlap with your node keys, you can use

Or something like:


Remember that this only works for GraphLinksModels.

How to assign the unique key value to the name property.

Both name and Key property value should be same.

While drag an drop then key and name should be same and unique

What’s wrong with setting the model’s linkKeyProperty to “name”?

How to set the linkKeyProperty to name.

var m = new go.GraphLinksModel();
m.linkKeyProperty = "name";
... set any other properties that you need on the model ...
myDiagram.model = m;

Its not working, Is any other way to assign the key values to name. both should be same and unique. Now its working for key.

We are working on Drag and drop pallete.

And have you set linkKeyProperty on both models?


      this.model.linkKeyProperty = 'key';
      this.model.linkKeyProperty = 'name';

That’s just setting it to “name”, which is what I think you want.

No, I said “both models”. Something like:

myDiagram.model = $(go.GraphLinksModel,
  linkKeyProperty: "name",
  nodeDataArray: [ . . . ],
  linkDataArray: [ . . . ]

myPalette.model = $(go.GraphLinksModel,
  linkKeyProperty: "name",
  nodeDataArray: [ . . . ]

Also, to be clear, GoJS does not support the notion of “composite keys” from relational database terminology.