Find link labelKeys

How Can I find a link by a labelKeys. I try to find by example myDiagram.findLinksByExample({ “labelKeys”: “-10” }) but i can’t. I only can findLinksByExample with from or to. Please, can someone help me? Thank you very much.

I have this:

{ "class": "go.GraphLinksModel",
  "linkLabelKeysProperty": "labelKeys",
  "nodeDataArray": [ 
....
],
  "linkDataArray": [ 
{"category":"pointer", "from":3, "to":4, "labelKeys":[ -8 ]},
{"category":"pointer", "from":4, "to":6, "labelKeys":[ -10 ]},
{"category":"pointer", "from":6, "to":5, "labelKeys":[ -11 ]},
{"category":"pointer", "from":7, "to":6, "labelKeys":[ -12 ]},
{"category":"pointer", "from":3, "to":7, "labelKeys":[ -13 ]},
{"category":"pointer", "from":5, "to":7, "labelKeys":[ -14 ]}
 ]}

First, did you mean to use plain old link keys? You can do so by setting the linkKeyProperty and using getKeyForLinkData

if labelKeys is serving some other purpse in your data, you will need a smarter find… predicate, since labelKeys in your data is an array and not a number or string.

I tried myDiagram.findLinksByExample({ labelKeys: [-8] }), but it looks like there might be a bug with findLinksByExample using arrays. We’ll investigate that.

We have fixed a bug dealing with how findNodesByExample and findLinksByExample match arrays. That will be out in the next release. We just released yesterday, so the next release may be a week or two.

Sorry for that bug. I believe it is fixed in the next release, which will probably be next week.

Until then, you’ll need to implement the search yourself. Something like:

  myDiagram.links.filter(l => l.data.labelKeys[0] === -8)

Thank you very much.

It works, I did that:

        function canviarRelacio(port, origen, desti) {
            valorClau = port.labeledLink.data.labelKeys;
            var it = myDiagram.links;
            var aux = false;
            var actual;
            while (!aux && it.next() ) {
                actual = it.value.data.labelKeys[0];
                aux = actual == valorClau;
            }
        }