I have a Sankey graph and we use TreeExpanderButton to expand and collapse nodes.
I want to conditionally collapse few nodes by default. And other nodes will be in expanded form.
Something like
Normally one would add a data Binding to the Node template:
$(go.Node, . . .,
new go.Binding("isTreeExpanded"),
. . .
or:
new go.Node(. . .)
.bind("isTreeExpanded")
. . .
Now in the model data, for each node you can add the data.isTreeExpanded
property with a value of true or false.
If you don’t set it on the node data object (or set it to undefined
), the value of the Node.isTreeExpanded property is not set, and its default value is true.
If you don’t like the name “isTreeExpanded” on your data, you can name it whatever you want, and pass that name as the second argument to the Binding constructor or bind method.
If you want to save your diagram model in a particular expansion state, make the Binding a TwoWay Binding:
new go.Binding("isTreeExpanded", "expanded").makeTwoWay()