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

Org Chart Drill Down Doesn't work

3 Answers 118 Views
OrgChart
This is a migrated thread and some comments may be shown as answers.
Avihai
Top achievements
Rank 1
Avihai asked on 11 Apr 2017, 09:54 PM

Hi Telerik Team,

I'm having an issue with the drill down functionality, I'm binding the data source to the org chart control on Page Load Event and I have a drill down handler when the user click on the drill down icon.

 

The data tables I'm using to bind the org chart are:

1). OrgChartStructure (Which will be defined the levels of the organization chart)

Id | ParentID|Title

1    NULL     CEO (PK)

2     1            President

3     2            VP Sales

2). Org Chart

Id| NodeID| FirstName|LastName| Title|ImgPath

1    1             John        Doe            CEO

2     2            Jane        Doe            President

3     2            James     Doe            VP Sales

 

My Code:

 

<div class="demo-container no-bg">
    <div class="search">
        <telerik:RadSearchBox RenderMode="Lightweight" runat="server"  ID="RadSearchBox1" DataTextField="FullName" DataValueField="NodeID" EnableAutoComplete="true"
            OnClientSearch="onClientSearch" Skin="Silk">
        </telerik:RadSearchBox>
        <div class="rocBreadCrumb"></div>
    </div>
    <telerik:RadOrgChart ID="rocOrgChart"
        runat="server"
        RenderMode="Lightweight"
        EnableCollapsing="true"
        EnableDrillDown="true"
        EnableGroupCollapsing="true"
        Skin="Silk"
        DataFieldID="ID" DataFieldParentID="ParentID"
        DataTextField="FullName" DataImageUrlField="ImgPath">
    </telerik:RadOrgChart>
</div>

BackCode:

 

 Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        If Not Page.IsPostBack Then
            GenerateOrgChart()
        End If
    End Sub

 

 Public Sub GenerateOrgChart()
        Try
            Dim ds_orgStructure As DataSet = sqhBI20.ReturnDataSetFromSproc("spGetOrgChartStructure")
            Dim dt_orgStucture As DataTable = ds_orgStructure.Tables(0)
            If Not dt_orgStucture Is Nothing Then
                rocOrgChart.GroupEnabledBinding.NodeBindingSettings.DataFieldID = "ID"
                rocOrgChart.GroupEnabledBinding.NodeBindingSettings.DataFieldParentID = "ParentID"
                rocOrgChart.GroupEnabledBinding.NodeBindingSettings.DataSource = ds_orgStructure
            End If


            Dim ds_OrgChart As DataSet = sqhBI20.ReturnDataSetFromSproc("SpGetOrgChart")
            Dim dt_OrgChart As DataTable = ds_OrgChart.Tables(0)
            If Not dt_OrgChart Is Nothing Then
                rocOrgChart.GroupEnabledBinding.GroupItemBindingSettings.DataFieldID = "ID"
                rocOrgChart.GroupEnabledBinding.GroupItemBindingSettings.DataFieldNodeID = "NodeID"
                rocOrgChart.GroupEnabledBinding.GroupItemBindingSettings.DataTextField = "FullName"
                rocOrgChart.GroupEnabledBinding.GroupItemBindingSettings.DataImageUrlField = "ImgPath"
                rocOrgChart.RenderedFields.ItemFields.Add(New Telerik.Web.UI.OrgChartRenderedField() With {.DataField = "NodeID"})
                rocOrgChart.GroupEnabledBinding.GroupItemBindingSettings.DataSource = ds_OrgChart
            End If
            rocOrgChart.DataBind()

            RadSearchBox1.Text = ""
            RadSearchBox1.DataSource = ds_OrgChart
            RadSearchBox1.DataBind()

        Catch ex As Exception
            Throw New Exception(ex.ToString())
        End Try
    End Sub

 

Public Sub rocOrgChart_DrillDown(sender As Object, e As Telerik.Web.UI.OrgChartDrillDownEventArguments) Handles rocOrgChart.DrillDown
    
        Dim item = New OrgChartGroupItem() With {.DataItem = "NodeID"}
        e.SourceNode.Renderer.Controls.Remove(e.SourceNode.Nodes.Renderer)
        e.SourceNode.GroupItems.Clear()
        e.SourceNode.Nodes.Clear()
        e.SourceNode.GroupItems.Add(item)

    End Sub

 

3 Answers, 1 is accepted

Sort by
0
Avihai
Top achievements
Rank 1
answered on 11 Apr 2017, 09:55 PM
How Do I Implement the drill down functionality correctly?
0
SMc
Top achievements
Rank 2
Iron
Veteran
Iron
answered on 11 Dec 2020, 08:27 PM
I too am having this issue... and I'm surprised there is no response!  
0
Peter Milchev
Telerik team
answered on 16 Dec 2020, 07:51 PM

Hello,

Here is the demo of the DrillDown functionality bound to a DataTable:

Additionally, you can use the MaxDataBindDepth property of the OrgChart to load only a limited number of levels.

Regards,
Peter Milchev
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Tags
OrgChart
Asked by
Avihai
Top achievements
Rank 1
Answers by
Avihai
Top achievements
Rank 1
SMc
Top achievements
Rank 2
Iron
Veteran
Iron
Peter Milchev
Telerik team
Share this question
or