Collapsing and Expanding Tree Branches

If a diagram represents a tree structure, the tree branch starting from a node can be collapsed or expanded again in order to hide or display hierarchy details. To enable this, call the expand method. To get or set whether a tree branch is expanded or collapsed, use the expanded property of its root node.

Displaying Expand/Collapse Button

If the expandable property of a node is set to true, there is a [±] button displayed beside the node to allow users to collapse or expand the tree branch starting there. By default, pressing that button automatically toggles the expanded property of the node and raises the treeExpanded or treeCollapsed events.

Defining Tree Direction

A node can be connected to other nodes through outgoing and incoming links. Setting the expandOnIncoming property specifies which items connected to a node will be regarded as its descendants. If expandOnIncoming is false (default value) then each node will be regarded as a parent of its outgoing links and the items attached to them. If expandOnIncoming is set to true, the node’s incoming links define its children. So, this property specifies the direction of parent-children relationship between diagram items and respectively the overall direction in which collapsing / expanding is done.