Org Chart Expand / Collapse doesn't work with no absolute hierarchy

2 posts, 0 answers
  1. JP
    JP avatar
    10 posts
    Member since:
    May 2006

    Posted 24 Apr 2013 Link to this post


    I am trying to use Expand / Collapse feature of Org Chart control. My data source not necessarily have absolute hierarchy as shown in example ( Record with id 1 and 7 doesn't have manager id).

    My data binds with the control perfectly, but the expand / collapse feature doesn't work.

    Protected Sub Test_TestOrgChart_Load(sender As Object, e As System.EventArgs) Handles Me.Load
        End Sub
        Private Sub BindOrgChart(Optional ByVal ExpandAll As Boolean = True)
            Dim employees = CreateEmployees()
            RadOrgChartEmployees.DataFieldID = "EmployeeID"
            RadOrgChartEmployees.DataTextField = "EmployeeName"
            RadOrgChartEmployees.DataFieldParentID = "ManagerID"
            RadOrgChartEmployees.DataSource = employees
            If ExpandAll Then
            End If
        End Sub
        Private Function CreateEmployees() As DataTable
            Dim employees = New DataTable()
            employees.Rows.Add(New String() {"1", Nothing, "Emp CEO", "CE0"})
            employees.Rows.Add(New String() {"2", "1", "Emp President BSS", "President BSS"})
            employees.Rows.Add(New String() {"3", "1", "Emp COO", "COO"})
            employees.Rows.Add(New String() {"4", "2", "Emp VP ST", "VP Software Tech"})
            employees.Rows.Add(New String() {"5", "2", "EMP Director SD", "Director Software Development"})
            employees.Rows.Add(New String() {"6", "5", "EMP Developer", "Developer"})
            employees.Rows.Add(New String() {"7", Nothing, "EMP CFO", "CFO"})
            employees.Rows.Add(New String() {"8", "7", "EMP President IT", "President IT"})
            Return employees
        End Function
  2. Plamen
    Plamen avatar
    2926 posts

    Posted 25 Apr 2013 Link to this post

    Hi Jean-Pierre,

    The issue is observed because by design RadOrgChart does not support multiple root items and multiple parents  because it illustrates a strongly hierarchical relationship. In your particular case because of the second root there is a javascript error and that is why the control can not work properly.

    Hope this will explain the issue.

    Kind regards,
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Back to Top