Hello,
I use group by Mode in WinGrid (Infragistics 8.3)
I need to group by records accroding to column A but I neeed to sort them by the summary value of column B when I click on the header of column B.
I have created my own Groub By Comparer but I do not manage to enter in it when click on the header of a column. It is the same problem after overriding the HeaderClickAction of this column with SortSingle or SortMulti..
The problem is I cannot manage to enter in the GroupByComparer of my column. How can I do that ?
(In fact I enter in the GroupByComparer only ath the loading on my group By Rows in the method Infragistics2.Win.UltraWinGrid.v8.3.dll!Infragistics.Win.UltraWinGrid.RowsCollection.InitGroupByRows() + 0x16a bytes )
How can I enter in this InitGroupByRows method I click on the Header of a column ?
Thx
Perhaps I was misreading the original question then. The GroupByComparer should be sorting the GroupByRows when the column that the comparer is assigned to is grouped. I tested this in a quick sample application and my sort comparer was correctly being used when I clicked on the column in the GroupByBox to sort. Are you sure that your comparer isn't being hit? The following code worked for me:
public class GSC : IComparer{ public int Compare(object x, object y) { return ((IComparable)((UltraGridGroupByRow)x).Value).CompareTo(((UltraGridGroupByRow)y).Value); }}
this.ultraGrid1.DisplayLayout.Bands[0].Columns[0].GroupByComparer = new GSC();
Obviously this is a hack comparer, but it was good enough for the test and was properly being hit for sorting. Perhaps if you post what you are doing and what you're seeing, I can test it out.
-Matt
In fact it is true that in my example I had one child row in each GroupByRow.
The point is that I want to sort the GroupByRows not the child rows inside each groupByRow.
It is why I firt wanted to use the GroupByComparer.
How can I do that ?
I'm not quite sure that I understand what your question is. Are you saying that the SortComparer property of a column is ignored when they are children of a GroupByRow? I just tested this out, and the only time that the SortComparer property was ignored for an ungrouped column was when there was only a single row in the Rows collection (i.e. the GroupByRow had a single child).
In fact I have also defined a SortComparer but I cannot enter in it when i am in group by mode.
I have tried several header click action mode and it is always the same thing. I manage to enter in my own comparers only when the group by is build.
Do you know a way to enter in the compare Method of a SortComprarer/groupbycomparer ? ( I could use it in the BeforeSortChange of my grid )
When you click on a header, the GroupByComparer isn't used as this is only utilized when peforming the actual grouping. You would need to implement the IComparer interface and set it on the SortComparer property of the column.