Hello,
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
expandedRows.Clear()
selectedRows.Clear()
For
i = 0
To
myGridView.Rows.Count - 1
expandedRows.Add(myGridView.Rows(i).IsExpanded)
' How can I remember which page tab is displayed currently?
selectedRows.Add(myGridView.Rows(i).IsSelected)
Next
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)
Next
End
If
If
selectedRows IsNot
Nothing
Then
For
i = 0
To
selectedRows.Count - 1
myGridView.Rows(i).IsSelected = selectedRows(i)
Next
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.