@seenu wrote:
Hi,
Below, script i am generating tree node template dynamically. First time tree node template loading perfectly but when i generate next time am getting "Invalid div ID, div already associate with diagram". Then I surfed google and i got answer to set Diagram.div = null.
But my question is,
Where shall i set diagram,div = null?
in below script after generated tree node, i am set up diagram.div = null. is that correct??Please help me.
var make = go.GraphObject.make;
myDiagram = make(go.Diagram, "myDiagramDiv",
{
initialContentAlignment: go.Spot.Top, // center Diagram contents
allowDrop: true,
"undoManager.isEnabled": true, // enable Ctrl-Z to undo and Ctrl-Y to redo
layout: make(go.TreeLayout, // specify a Diagram.layout that arranges trees
{ angle: 90, layerSpacing: 55, nodeSpacing: 20, })
});myDiagram.nodeTemplate = make(go.Node, "Horizontal", { background: "#d7d3c8" }, make(go.Picture, { margin: 5, width: 30, height: 20 }, new go.Binding("source")), make(go.TextBlock, "Default Text", { margin: 12, stroke: "black", font: "bold 10px sans-serif" }, new go.Binding("text", "name")), { toolTip: // define a tooltip for each node that displays the color as text make(go.Adornment, "Auto", make(go.Shape, { fill: "#FFFFCC" }), make(go.TextBlock, { margin: 4 }, new go.Binding("text", "name")) ) // end of Adornment }, make("TreeExpanderButton") ); // define a Link template that routes orthogonally, with no arrowhead myDiagram.linkTemplate = make(go.Link, { routing: go.Link.Orthogonal, corner: 5 }, make(go.Shape), make(go.Shape, // the "from" end arrowhead { fromArrow: "Chevron" }), // $(go.Shape), // this is the link shape (the line) make(go.Shape, { strokeWidth: 2, stroke: "#555", toArrow: "Standard", fill: "red" })// this is an arrowhead //{ toArrow: "OpenTriangle", fill: null } ); var model = make(go.TreeModel); model.nodeDataArray = eval(json); myDiagram.model = model;
- ## var element = document.getElementById('myDiagramDiv');
- myDiagram.element = null;
Posts: 1
Participants: 1