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 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…