Diagram.model value is not an instance of Model: GraphLinksModel


#1

Hi walter,

Good Morning
Please help.
I am facing the below problem when i use cdn link of gojs its working fine.
https://cdnjs.cloudflare.com/ajax/libs/gojs/1.8.35/go-debug.js.
In my project i am using flowchart samples.
I am assgin the diagram values using below script
myDiagram.model = go.Model.fromJson(document.getElementById(“mySavedModel”).value);

my values to load in diagram is below

{ "class": "go.GraphLinksModel",

"linkFromPortIdProperty": "fromPort",

"linkToPortIdProperty": "toPort",

"nodeDataArray": [

{"key":0, "category":"Start", "loc":"126.99999999999997 -134", "text":"Start"},

{"text":"New contract / \nNew Job data \n", "key":1, "loc":"127 -47"},

{"category":"Conditional", "text":"Is the key to open ", "key":2, "loc":"127.00000000000006 79.00000000000003"}

],

"linkDataArray": [

{"from":"0", "to":"1", "points":[126.99999999999997,-113.99118095220521,126.99999999999997,-103.99118095220521,126.99999999999997,-100.05613582522369,127,-100.05613582522369,127,-96.12109069824218,127,-86.12109069824218]},

{"from":"1", "to":"2", "points":[127,-7.878909301757815,127,2.1210906982421847,127,11.999999999999988,127.00000000000003,11.999999999999988,127.00000000000003,21.87890930175779,127.00000000000003,31.87890930175779]}

]


#2

Hi walter ,
Any solution for the above issue.


#3

Hi walter,
Any inputs for the above issue.


#4

We are on the east coast of the United States.

The code that you quoted looks OK to me. When you debug your app, what is the value being assigned to your Diagram.model? What type is it and what produced that value?


#5

Hi walter, sorry

When the line is reached i am getting this error “Diagram.model value is not an instance of Model: GraphLinksModel”
myDiagram.model = go.Model.fromJson(document.getElementById(“mySavedModel”).value);

I as using flowchart samples. In my diagram i have two button one is “Dynamic” and “Static”. When i click Dynamic i am adding node one by one. When i click Static i am displaying entire flowchart fully. So when i click the static button i am fetching data from textarea. That time its giving error.

But when use CDN link its not giving any error.But when go-debug.js in my project its giving error. Pls help

image


#6

That’s odd – are the go-debug.js files the same? Are they not being loaded the same way?

If it works when using the file from the CDN, why can"t you use that? That’s what most developers would want to do, to improve page load time and reduce their own server’s usage.