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

Event that signifies the tree is expanded/collapsed fully

$
0
0

@STM wrote:

Hi,

I have a very basic functionality to expand and collapse the tree of a particular node for which I have the following code.

node = diagramInstace.findNodeForKey(nodeId);
    						
if ( node.isTreeExpanded ) 
    diagramInstace.commandHandler.collapseTree(node);
else
    diagramInstace.commandHandler.expandTree(node);

diagramInstace.commandhandler.scrollToPart(node.actualBounds);

But the problems here is the scrollToPart is not working as expected.

I have tree layout applied by default on diagram.

Upon debugging it looked like my scrollToPart statement is executing before the tree is completely expanded or collapsed.

I tried TreeCollapsed and TreeExpanded event on diagram but still no luck.
Following is my code in these event

var it = arguments[0].subject.iterator;
while (it.next()) {
   var item = it.value;
   node = this._diagramInstace.findNodeForKey(item.data.id);
   this._diagramInstace.commandHandler.scrollToPart(node.actualBounds);
}

So is there a event which states the expand/ collapse process is completed and I can scrollToPart now.

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 7069

Trending Articles