Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
2114
Adding multiple Group Columns does not work
posted

I need to save the state of the grouping of a WinGrid in my form.

So I save the grouping orders in the Database, and then, when (re)loading my inherited UltraWinGrid, i do the following:

      If Me.DisplayLayout.Bands.Count > 0 Then
        Me.DisplayLayout.Bands(0).ResetSortedColumns()
 
        For Each strColName As String In objGroupByColumnDictionary.Values
          Me.DisplayLayout.Bands(0).SortedColumns.Add(strColName, FalseTrue)
        Next strColName
      End If

This code works... but for a single group column (!?) When I have multiple columns only the last added column is displayed in the groups....

How to fix it?

Update:

The code above was used in the Form's Constructor.

I need to "refresh" in after the form was displayed, to make it work like is should:


Private Sub SelectionAvancee_Shown(sender As Object, e As System.EventArgs) Handles Me.Shown
Me.ReloadResultGroupByColumns()
End Sub

Private Sub ReloadResultGroupByColumns()
'' reinitialise sortedColumns
Dim sortedColumns As New List(Of String)
For Each col As Infragistics.Win.UltraWinGrid.UltraGridColumn In grdResult.DisplayLayout.Bands(0).SortedColumns
sortedColumns.Add(col.Key)
Next col
grdResult.DisplayLayout.Bands(0).ResetSortedColumns()
For Each colKey As String In sortedColumns
grdResult.DisplayLayout.Bands(0).SortedColumns.Add(colKey, False, True)
Next colKey
''''
End Sub