Tree Mapping :: Not loading into the Div if its already exists

Its working when I click the PV mapping because this comes at first

When I immediately go the Mapping it shows empty. even I set the diagram.div = null. But nodedataarray and linkdata also generated
myDiagram.div = null;

If I came from the any other tab its working.

I do not understand your situation. Please explain to someone who does not know what you have built here exactly what HTML DOM there is and what happens when the user clicks on a “tab”. How many Diagrams are there supposed to be at any one instant?

I’m using only one div for both the mapping

  <div id='myDiagramDiv'></div>

when I call the second mapping to the first mapping it shows empty . The codes are run and its not assigned to the ‘myDiagramDiv’.

OK, if there is only one HTML DIV for your diagrams, then I recommend that you just reuse the single Diagram instance that you first setup for that DIV element.

Showing a new “diagram” in that one Diagram instance is just a matter of replacing its Diagram.model. You never have to set Diagram.div.

If for some reason you want that DIV to be blank you can just replace the model with an empty one. Or change the DIV to be display:none.

How to replace the Diagram.model

this.myDiagram.model = null; ?

How to replace the Diagram.model

this.myDiagram.model = null; ?

How to replace the this.myDiagram ?

I think due to this the code has run then nodeData & LinkData are created but its not assigned to the DIV. It shows empty. How to clear the entire diagram and assign back the new one ? Code Please…

myDiagram.model = new go.GraphLinksModel();

1 Like