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

Parents
  • 53790
    posted

    Hello serhiol,

    There are different approaches to solve this task. Looking at your code, it seems to be correct. In my test sample it works properly. I didn`t find something wrong, so maybe the reasons for your issue could be in another place.

    I think that we have better solution of your task. My suggestion is to save and load UltraGird`s layout using the methods

    - ultraGrid1.DisplayLayout.Save();

    - ultraGrid1.DisplayLayout.Load();

    Let me know if you have any  further questions.

    Regards

     

Reply Children
No Data