Hi, We are working in a grid with 'Outlook Group by' style. In order to sort by summaries we use a custom 'Groupby' class using as example http://es.infragistics.com/community/forums/p/9904/62322.aspx.The problem appears when we group by a column with near 1500 different values, from 12000 rows. If i try to sort by summary column the grid takes more than 5 min to sort it. Is it normal?
I copy past the class and the call.
Public Class clsGroupByRowsSorter Implements IComparer Private Property _Column As UltraGridColumn Public Sub New(Column As UltraGridColumn) Me._Column = Column End Sub Private Function Compare(ByVal xObj As Object, ByVal yObj As Object) As Integer Implements IComparer.Compare If xObj.GetType = GetType(Infragistics.Win.UltraWinGrid.UltraGridGroupByRow) And yObj.GetType = GetType(Infragistics.Win.UltraWinGrid.UltraGridGroupByRow) Then Dim x As Infragistics.Win.UltraWinGrid.UltraGridGroupByRow = DirectCast(xObj, Infragistics.Win.UltraWinGrid.UltraGridGroupByRow) Dim y As Infragistics.Win.UltraWinGrid.UltraGridGroupByRow = DirectCast(yObj, Infragistics.Win.UltraWinGrid.UltraGridGroupByRow) Dim dblSummaryX As Double = 0 Dim dblSummaryY As Double = 0 Dim objSummaryX As String = x.Rows.SummaryValues(Me._Column.Key).Value.ToString Dim objSummaryY As String = y.Rows.SummaryValues(Me._Column.Key).Value.ToString If Double.TryParse(objSummaryX, dblSummaryX) AndAlso Double.TryParse(objSummaryY, dblSummaryY) Then Select Case Me._Column.SortIndicator Case SortIndicator.Ascending Return dblSummaryX.CompareTo(dblSummaryY) Case SortIndicator.Descending Return dblSummaryY.CompareTo(dblSummaryX) Case Else Return 0 End Select Else Return 0 End If Else Return Nothing End If End Function End Class
Private Sub sugCobro_AfterSortChange(sender As Object, e As Infragistics.Win.UltraWinGrid.BandEventArgs) Handles sugCobro.AfterSortChange For Each oCol As UltraGridColumn In Me.DisplayLayout.Bands(0).SortedColumns oCol.GroupByComparer = New clsGroupByRowsSorter(Me._LastColumnClicked) Next End Sub
I attach a sample using the initializeLayout event
We use the AfterSortChange event because our GroupBy Class needs the summary's column for sort it.
Hi,
It's hard to say without seeing a running sample that I could debug.
This probably is not related to the performance issue you are seeing, but assigning the SortComparer inside the AfterSortChanged event is probably not a good idea. Why do it there? It would more sense to do this once, up-front, in the InitializeLayout event. Otherwise, you are continuously created new instances of your sort comparer and re-assigning them to every column every time you change a sort. And there's really no reason to that do.
Aside from that, I don't see anything obviously wrong or inefficient about this code. But like I said, I would need to see it in action and debug it to find out why it's slow.