Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
388 views
in Technique[技术] by (71.8m points)

gojs - gojs addNodeDataFunction不会将节点添加到图中(gojs addNodeDataFunction doesn't add node to diagram)

my code:

(我的代码:)

 let node1 =this.from;
 node1.key = id + "_0";
 node1.side = "left";
 node1.group = id;
 let node2 = this.to;
 node2.key = id + "_1";
 node2.side = "right";
 node2.group = id;
 diagram.startTransaction("new group");
 let groupNode = { key: id, isGroup: true, details: this };
 diagram.model.addNodeData(groupNode);
 diagram.commitTransaction("new group");
 diagram.startTransaction("new data");
 diagram.model.addNodeData(node1);
 diagram.model.addNodeData(node2);
 diagram.model.addLinkData({ from: node1.key, to: node2.key, fromPort: this.from.port.InvPortName, toPort: this.to.port.InvPortName, operation: this.operation });
diagram.commitTransaction("new data");

node2 added to the diagram.

(将node2添加到图中。)

node1 is added to diagram.model.nodeDataArray, but not shown in the diagram, and getNodeTemplate function doesn't execute.

(将node1添加到diagram.model.nodeDataArray,但未在图中显示,并且getNodeTemplate函数不执行。)

  ask by rivka levi translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...