Quantcast
Channel: GoJS - Northwoods Software
Viewing all articles
Browse latest Browse all 7069

Insert node object inside linkDataArray

$
0
0

@jose_vi wrote:

I have defined a GraphLinksModel like this:

  $(go.GraphLinksModel,
  {
     archetypeNodeData: {},
     linkFromPortIdProperty: 'source',
     linkFromKeyProperty: 'sourceColumn',
     linkToPortIdProperty: 'destination',
     linkToKeyProperty: 'destinationColumn',
     // automatically update the model that is shown on this page
     'Changed': (e) => {
         if (e.isTransactionFinished) {
            console.log('Changed ' + this.diagram.model.toJson());
         }
     },
     nodeDataArray: this.visualOrigins,
     linkDataArray: this.relations
});

This generates an output:

"linkDataArray": [
    {"source":"Record1", "sourceColumn":"field1", "destination":"Record2",
    "destinationColumn":"fieldA"}
]}

It is possible to generate this output, but with the javascript objects which are referencing inside it? Like this:

 "linkDataArray": [
    {"source":"Record1",
    "sourceObjectNode": {sourceObjectReferenced},
    "sourceColumn":"field1",
    "sourceColumnObjectNode": {sourceColumnObjectNodeReferenced},
    "destination":"Record2",
    "destinationObjectNode": {destinationObjectNodeReferenced},
    "destinationColumn":"fieldA",
    "destinationColumnNode": {destinationColumnObjectNodeReferenced}}
]}

The purpose of this would be having the linked nodes without making any processing.

Thanks in advance

Posts: 3

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 7069

Trending Articles