I think you misunderstand how those functions are used.
You seem to have implemented them correctly for getting property values. However those functions are also called when setting property values. That is when the second argument is supplied. It would not be an “old” value but the “new” value.
However one cannot change whether a node data object is a group or not, so the GraphLinksModel.nodeIsGroupProperty function does not need to handle setting the property.
Are you going to be setting GraphLinksModel.nodeGroupKeyProperty?
So if you set that GraphLinksModel property to a function, you have to handle the situation when there are two arguments passed to your function. In that case you have to modify the state of the first argument so that the link is coming out of the second argument, a node.
it doesn’t reaches the linkconnected method in node, there is no new link visible in ui itself, is there any method will be called when new link is created…?
So you have defined a Node | GoJS API event handler, and it is never called?
What are the answers to my other two questions?
And could you please confirm that the value of Diagram.model’s GraphLinksModel.linkDataArray has the data that you expect.
And what is an example of that data?
It is impossible to help you unless I can understand what you are doing and what you want to do. That is why I keep asking questions – otherwise I just have to guess. It would help if you provided answers and asked clear, directed, detailed, and concise questions.
So, are you calling GraphLinksModel.addLinkData to create a link? If so, what data are you passing to it?
To clarify, you are saying that after loading the model with an Array of seven link data objects, everything looks correct. Then some event happens that causes you to want to create another link.
The way to do that is to add a new link data object to the model within a transaction. An example is at State Chart – look at the addNodeAndLink function.
By the way, the eighth data that you added, at #7, seems incomplete. There is no data.link property.
in that example there is an click event for that button but in my case I clicking a port in a from node then dragged and dropped in a to port in another node
Ah, you had said that you were creating a link, but given the discussion about getting the model implemented correctly, I thought you were talking about doing so programmatically. You did not mention being the user and drawing a new link interactively.
The problem is that LinkingTool | GoJS API isn’t creating the link data object that you need. Are you not getting an exception when the user draws a link? Always check the console for warnings and errors. Use go-debug.js during development. Why isn’t your code
if (oldKey) linkData.link.outputPort.uid = oldKey as string
causing an exception because there is no linkData.link property value?
I also question the need for having the “link” property on the data at all. Why shouldn’t the properties be linkdata.type, linkdata.outputPort, and linkdata.inputPort? And what other properties do the inputPort and outputPort objects have?