This is a migrated thread and some comments may be shown as answers.

Organisation chart collapse

2 Answers 85 Views
Diagram, DiagramRibbonBar, DiagramToolBox
This is a migrated thread and some comments may be shown as answers.
Gigi
Top achievements
Rank 1
Gigi asked on 02 Feb 2017, 04:10 PM

Hi,

 

So I am building a dynamic organisation chart using RadDiagram. I have implemented the chart and the expansion of it. But now I would like to be able to collapse it. I have attached a photo to make it easier to explain.

So for example, if I press on 1.2.1 I would like to be able to collapse everything under. I have been able to collapse the shapes one level below only so in this case 1.2.1.1 and 1.2.1.2 using . it. But I am not sure how can I recurse for all the levels under it.

 

2 Answers, 1 is accepted

Sort by
0
Dimitar
Telerik team
answered on 03 Feb 2017, 12:05 PM
Hi Ghadeer,

You need to check the source of the connections (assuming that the Source and Target shapes of all connections are properly set):
public void GetChildren(ConnectionCollection items, RadDiagramShape shape)
{
    foreach (var connection in items)
    {
        if (((RadDiagramShape) connection.Source).Text == shape.Text)
        {
            Console.WriteLine(((RadDiagramShape) connection.Target).Text);
            GetChildren(items, connection.Target as RadDiagramShape);
        }
    }
}
 
I hope this will be useful. Let me know if you have additional questions.

Regards,
Dimitar
Telerik by Progress
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0
Gigi
Top achievements
Rank 1
answered on 03 Feb 2017, 01:49 PM

That works like magic!

Thank you very much :)

Tags
Diagram, DiagramRibbonBar, DiagramToolBox
Asked by
Gigi
Top achievements
Rank 1
Answers by
Dimitar
Telerik team
Gigi
Top achievements
Rank 1
Share this question
or