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

Error in iterating over links and adding new links

$
0
0

@no_one345 wrote:

i m working on a diagram this is a follow up to my last question which u answered by saying me to add links to diagram instead of model in loading the model now i m trying to iterate over link data to put virtual links in my diagram using this code

function makeVirtualLinks()
{
var checkJson={};
myDiagram.links.each(function(link) {

var fromParse = link.fromNode;
var toParse = link.toNode;
var fromGroup=fromParse.data.group;
var toGroup = toParse.data.group;
var linkFlag = checkDupLink(checkJson,fromGroup,toGroup);

if (!linkFlag)
{
  myDiagram.startTransaction("addVlinks");
  var linkdata = Go(go.Link);
    linkdata.fromNode = myDiagram.findNodeForKey("fromGroup");
    linkdata.toNode =  myDiagram.findNodeForKey("toGroup");
    myDiagram.add(linkdata);
    checkJson.fromGroup=toGroup;

    myDiagram.commitTransaction("addVlinks");

      }

}
);

i m getting an error

can i not add links while the itrator is itrating?
do i need to add the data to a separate array? if so is there a way to add collection of links to diagram?

Posts: 3

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 7069

Trending Articles