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

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

1 Answer 130 Views
OrgChart
This is a migrated thread and some comments may be shown as answers.
JP
Top achievements
Rank 2
JP asked on 24 Apr 2013, 08:11 PM
Hi,

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
        BindOrgChart()
    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
 
        RadOrgChartEmployees.DataBind()
 
 
        If ExpandAll Then
            RadOrgChartEmployees.ExpandAllNodes()
        Else
            RadOrgChartEmployees.CollapseAllNodes()
        End If
    End Sub
 
    Private Function CreateEmployees() As DataTable
        Dim employees = New DataTable()
 
        employees.Columns.Add("EmployeeID")
        employees.Columns.Add("ManagerID")
        employees.Columns.Add("EmployeeName")
        employees.Columns.Add("JobTitle")
 
        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

1 Answer, 1 is accepted

Sort by
0
Plamen
Telerik team
answered on 25 Apr 2013, 01:46 PM
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,
Plamen
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.
Tags
OrgChart
Asked by
JP
Top achievements
Rank 2
Answers by
Plamen
Telerik team
Share this question
or