Restore selected tab in hierarchy child page view after data refresh

2 posts, 0 answers
  1. Kun
    Kun avatar
    44 posts
    Member since:
    Aug 2018

    Posted 22 Jan 2019 Link to this post


    I have 3 hierarchical levels in my grid. Here is the structure:

    Master template

    |___tab1: Details (html view)

    |___tab2: Orders (standard grid)

           |___tab2-1: Clients (standard grid)

    |___tab3: Networks (standard grid)


    I'am inspired by some posts in the forum to save and restore the expanded rows and selected rows. It works great.

    I save the grid state before data refresh, and reset after data refresh. Here is the code.

    Dim scrollpos As Integer = -1
    Dim CurrentRow As Integer = -1
    Dim expandedRows As New List(Of Boolean)()
    Dim selectedRows As New List(Of Boolean)()
        Private Sub SaveSeletectedAndExpanded()
            scrollpos = myGridView.TableElement.VScrollBar.Value
            If myGridView.CurrentRow IsNot Nothing Then
                CurrentRow = myGridView.CurrentRow.Index
            End If
            If myGridView.Rows Is Nothing Then
                Exit Sub
            End If
            For i = 0 To myGridView.Rows.Count - 1
                ' How can I remember which page tab is displayed currently?
        End Sub
        Private Sub RestoreSeletectedAndExpanded()
            If scrollpos <> -1 Then
                myGridView.TableElement.VScrollBar.Value = scrollpos
            End If
            If CurrentRow <> -1 Then
                myGridView.CurrentRow = myGridView.Rows(CurrentRow)
            End If
            If expandedRows IsNot Nothing Then
                For i = 0 To expandedRows.Count - 1
                    myGridView.Rows(i).IsExpanded = expandedRows(i)               
            End If
            If selectedRows IsNot Nothing Then
                For i = 0 To selectedRows.Count - 1
                    myGridView.Rows(i).IsSelected = selectedRows(i)
            End If
        End Sub


    But I've found that the current selected tabbed view in the expanded row is reset to default after refresh.

    How can I save the current selected tabbled view index for the expanded rows ?


    Thank you by advanced.

  2. Hristo
    Hristo avatar
    1520 posts

    Posted 23 Jan 2019 Link to this post

    Hello Kung,

    The GridViewHierarchyRowInfo has an ActiveView property and you can store its index within the Views collection. I am attaching my test project demonstrating a possible approach.

    Let me know if you need further assistance.

    Progress Telerik
    Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Back to Top