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
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.
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.
I can't run your sample. It looks like you left out a bunch of neccessary files.
Error 1 Resource file "My Project\Resources.resx" cannot be found. GroupbySortError 2 Unable to open module file 'C:\Users\MikeS\Desktop\GroupbySort\My Project\Application.Designer.vb': The system cannot find the file specified. C:\Users\MikeS\Desktop\GroupbySort\My Project\Application.Designer.vb 1 1 GroupbySortError 3 Unable to open module file 'C:\Users\MikeS\Desktop\GroupbySort\My Project\AssemblyInfo.vb': The system cannot find the file specified. C:\Users\MikeS\Desktop\GroupbySort\My Project\AssemblyInfo.vb 1 1 GroupbySortError 4 Unable to open module file 'C:\Users\MikeS\Desktop\GroupbySort\My Project\Resources.Designer.vb': The system cannot find the file specified. C:\Users\MikeS\Desktop\GroupbySort\My Project\Resources.Designer.vb 1 1 GroupbySortError 5 Unable to open module file 'C:\Users\MikeS\Desktop\GroupbySort\My Project\Settings.Designer.vb': The system cannot find the file specified. C:\Users\MikeS\Desktop\GroupbySort\My Project\Settings.Designer.vb 1 1 GroupbySort
Sorry Mike..
I re-attach the file
I think this time the project will be OK
We updated to version 13.2 and it's looks works ok now.
Thanks.
Hi Mike,
I see that you are ritght. If i load the 214 customers and sort, and then reload with the 1455 there's no difference.
But, our problem is if you load first the 1455 groups (we put the other button just to compare)
Steps:
1) Run the proyect.
2) Click over 1455 customers.
3) Try to sort by total.
4) Wait.
We are using Infragistics4.Win.UltraWinGrid.v12.2 (CLR4)
Okay, I can run the sample, now. But I'm not sure what I am supposed to be seeing.
I ran the sample and clicked the first button to load 214 customers. The grid loads almost instantaneously. I changed the sort direction a couple of times and it seems to be very responsive with no delay at all.
Then I tried the same thing with the 1455 button, and I don't see any noticeable difference. It's just as fast and responsive either way.
Am I missing something? Is there something else I need to do in order to get the problem to occur?
If not, then maybe there's a bug in the version of the controls you are using and you just need to get the latest service release.
How to get the latest service release - Infragistics Community