How to implement grouping in the Org Chart

We want to display grouping in a org chart where in the group is displayed at mouse click of a ‘+’ button.
In short we need to merge the features from the ‘Org Chart Bus’ with the ‘Incremental Tree’ or ‘Grouping’ samples for expansion.
How can we achieve the same?

[I’ve moved your post from the GoDiagram forum to this, the GoXam forum. Unless you really are working with GoDiagram as well as with GoXam?]

That’s easy enough to do: just add a Button to the Node DataTemplate, and implement its Click event handler to be just like the one in the IncrementalTree sample.

But note that the “CollapseExpandButton_Click” event handler in the IncrementalTree sample also keeps track of whether the subtree had ever been expanded, and to dynamically create the children if not. I don’t know if you need that functionality or whether you will have the whole tree in model/memory initially.

If you don’t need that only-create-children-on-first-expand functionality, you might want to copy the code from the VisualTree sample instead, which is simpler.

Hi Walter, Thanks for the help!

We did manage to achieve this.

We want to expand all the node groupings by default. How do we achieve this?

I don’t understand your question. Isn’t it just a matter of making sure all of the nodes and links are there, and not collapsing any node or setting such state?

Hi Walter, we need 2 things

  1. To display the complete structure by default at the start.
  2. Provide 2 buttons - ‘Collapse All’ and ‘Expand All’ in the chart.
    We are using the same example as the Incremental Tree but this example shows only one record at the start and we are unable to display all the records in this example.
    Could you provide us with some help on the same as we did not meet with much success?

The differentiation for the Incremental Tree sample is to only create tree-children when the parent node is expanded, and not beforehand.

The Visual Tree sample demonstrates creating the whole tree initially and fully expanded.