Organisation chart collapse

3 posts, 0 answers
  1. Gigi
    Gigi avatar
    2 posts
    Member since:
    Dec 2016

    Posted 02 Feb 2017 Link to this post

    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 the outgoing links target. it. But I am not sure how can I recurse for all the levels under it.

     

  2. Dimitar
    Admin
    Dimitar avatar
    2903 posts

    Posted 03 Feb 2017 Link to this post

    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.
  3. Gigi
    Gigi avatar
    2 posts
    Member since:
    Dec 2016

    Posted 03 Feb 2017 in reply to Dimitar Link to this post

    That works like magic!

    Thank you very much :)

Back to Top