Org Chart Drill Down Doesn't work

2 posts, 0 answers
  1. Avihai
    Avihai avatar
    2 posts
    Member since:
    Feb 2017

    Posted 11 Apr 2017 Link to this post

    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

     

  2. Avihai
    Avihai avatar
    2 posts
    Member since:
    Feb 2017

    Posted 11 Apr 2017 in reply to Avihai Link to this post

    How Do I Implement the drill down functionality correctly?
Back to Top