Hi
I have gone through several posts on this topic, but for some reason, must be missing some piece.
We have an ultragrid with many columns.
I want to programmatically set the sorting of multiple columns based on a boolean flag (yes sorts to one set of four columns; no sets to a different set.)
Is there an end to end example? I have provided the pieces I tried to put together myself.
Do I need
1. something in the ugrd_AfterSortChange or ugrd_BeforeSortChange routines?
2. ugrd_InitializeLayout routine, such as:
e.Layout.Override.HeaderClickAction = HeaderClickAction.SortMulti
3. I have the following rows set as my multi for one condition using the following syntax
ugrd.DisplayLayout.Override.HeaderClickAction = HeaderClickAction.SortMulti
ugrd.DisplayLayout.Bands(c_bandAccounts).Columns("HistoryExistsSort").SortIndicator = SortIndicator.Ascending
ugrd.DisplayLayout.Bands(c_bandAccounts).Columns("FollowupSort").SortIndicator = SortIndicator.Ascending
ugrd.DisplayLayout.Bands(c_bandAccounts).Columns("GuarantorLastName").SortIndicator = SortIndicator.Ascending
ugrd.DisplayLayout.Bands(c_bandAccounts).Columns("AccountNumber").SortIndicator = SortIndicator.Ascending
Thank you,
- M
Hi Michael,
Setting the SortIndicator property on a column will clear the sorting on the other column. What you need to do is add to the SortedColumns collection so it's clear to the grid that you mean to add a column instead of just setting the sorting. Here's some sample code:
Private Sub UltraGrid1_InitializeLayout(ByVal sender As System.Object, ByVal e As Infragistics.Win.UltraWinGrid.InitializeLayoutEventArgs) Handles UltraGrid1.InitializeLayout Dim layout As UltraGridLayout = e.Layout Dim band As UltraGridBand = layout.Bands(0) Dim ov As UltraGridOverride = layout.Override ov.HeaderClickAction = HeaderClickAction.SortMulti band.SortedColumns.Add("Int32 1", False) band.SortedColumns.Add("String 1", False) band.SortedColumns.Add("DateTime 1", False) band.SortedColumns.Add("double 1", False) End Sub
Hi Mike,
I have a requirement to work both conditions Column selection & Column Sorting. Column/multi column selection & column sort.
Please suggest me best solution.
1. can i choose HeaderClickAction as select for column selection and for sorting implementation on mouseClick event.
2. can i choose HeaderClickAction as MultiSort for column sorting and for column selection implementation on mouseClick event.