Skip to content
This repository was archived by the owner on Jul 29, 2019. It is now read-only.
This repository was archived by the owner on Jul 29, 2019. It is now read-only.

getEdgeData array[connId] is undefined #2938

@kowdykung

Description

@kowdykung

I am working on saveAndLoad and manipulation example

I got this network which load form JSON.

image

I deleted node 1 and its edge, then I export to JSON file. I got the correct JSON file.

[
  {
    "x": 0,
    "y": -1,
    "id": "0",
    "connections": [
      "3",
      "2"
    ]
  },
  {
    "x": 123,
    "y": -7,
    "id": "2",
    "connections": [
      "0"
    ]
  },
  {
    "x": -52,
    "y": -115,
    "id": "3",
    "connections": [
      "0"
    ]
  }
]

When I want to load this JSON back but it's got an error on import JSON in function getEdgeData

image

I don't know why this function error as I see it should be correct because of JSON is correct.

var ourRequest = new XMLHttpRequest();
			ourRequest.open('GET','http://localhost/2.json');
			var inputData;
			ourRequest.onload = function() {
				inputData = JSON.parse(ourRequest.responseText);
				nodes = getNodeData(inputData);
				edges = getEdgeData(inputData);
				data = {
						nodes: nodes,
						edges: edges
				};

			};
			ourRequest.send();

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions