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

Refresh gojs diagram within same DIV

$
0
0

@sillyMredul wrote:

Hello,
I have a ‘script’ tab beside ‘graph’ tab were I am drawing a gojs diagram based on the content in script tab. It works fine for the first time. But while I change something on script tab & click graph tab to see the updated graph, I get Error: Invalid div id; div already has a Diagram associated with it

The graph is drawing with same name and inserting in same div [id=‘graph’]. I am calling same java script function by passing diff values for nodes and links (that I can see from first 2 line at console).

    console.log(JSON.stringify(self.linkDataArray))
    console.log(JSON.stringify(self.nodeDataArray))
    			
    //gojs graph
    var $ = go.GraphObject.make;
    		      
    Diagram =
    $(go.Diagram, "graph",
    {   		        	
      initialContentAlignment: go.Spot.Center,		//display the graph at center initially
      initialAutoScale: go.Diagram.UniformToFill,
      layout: $(go.LayeredDigraphLayout,				//graph layout is Layered
      { direction: 0 }),							//graph will extend towards Right direction
       "undoManager.isEnabled": true,
       "animationManager.isEnabled": true
       });

I have tried with ‘Diagram.div = null’ before Diagram. And logically it is not defined yet, so browser is giving error.
Thanks in advance for the help.

Posts: 2

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 6969

Trending Articles