Cannot find link by data


#1

i m trying to find link in graphlinkmodel the json is as follows

there is a link with key i need to alter it but i cant find it by
Screenshot%20from%202019-01-30%2018-26-42

the link is null

you can also see the link in first pic at the end of third last line


#2

Since you know the key, you should probably call GraphLinksModel.findLinkDataForKey, then use the return value (which is link data) in a call to Diagram.findLinkForData.


#3

findLinkDataForKey doesn’t exists on model or diagram


#4

Typescript believes instances of Diagram.model to be plain Models, but you are using GraphLinksModel. You can cast the model by saying (this.diagram.model as go.GraphLinksModel).findLinkDataForKey. Or since you are using the model in more than one place in your function, you could say const model = this.diagram.model as go.GraphLinksModel; and then reuse it that way.