How to add the Custom property in the data link array?
linkKeyProperty: ‘Id’// IMPORTANT! must be defined for merges and data sync when using GraphLinksModel
I want to send the linkConnectorType property to the link array.
All of those “…Property” properties are defined by the GraphLinksModel so that it knows how to interpret the data in the model. They basically define how the model figures out the relationships between the data.
However all other properties on the data are defined by your app – use whatever properties your app needs to show or remember. The model does not care about any properties except for those named by those “…Property” properties. So you do not need to declare whatever else you need.
Although I suppose you could consider that the second argument of a data Binding constructor is declaring that the template uses that data property.
Hi Walter how can i add new fields in the link data array? can u give me an example?
See for example the “text” and “color” properties on node data objects and the “color” property on link data objects in the Basic sample: Basic GoJS Sample
Hi Walter got it thanks for the support
I have done the changes in the
diagramModelChange(changes: go.IncrementalData): void
changes.modifiedLinkData.DiagramConnectorType = this.selectedConnectorData;
OK, it’s good that this is working for you, but I’m wondering about when it is that you are executing that code. Why is it that you only want to add that property in the onModelChanged event handler? That will get called at the end of each transaction. I’m wondering if it wouldn’t it make more sense to make that change at the point in which links are created? I guess it depends on exactly why you need to add those properties, and when you could do so.
thanks for the clarification and suggestion