Hi
I am binding my collection object to ultraGrid1. My collection is like orderby displayTitle.
I am using the following statement to get the groups.
this.ultraGrid1.DisplayLayout.Bands[0].SortedColumns.Add("title", false, true);
The groups are displaying in ascending order which I dont want.
I want to show the groups in the same oder of collection.
Need help.
Thanks
Rajesh...
Rajesh,
While you can control whether the items are sorted ascending or descending via the second parameter to the Add method, I don't think that there's any way to accomplish this. Grouping is tightly intertwined with sorting as you can't group without performing the sort on the items.
-Matt
Matt
Is there any way to re-order the groups in the way we want?
You may be able to do so by implementing IComparer and assigning that value to the SortComparer property of the column that you grouped, but as this only provides the values that you're comparing and not the underlying cell (or a reference to your datasource), this may not give you exactly what you want.
There is also a GroupBySortComparer on the column for controlling the sort order of the GroupBy rows in case you want them to be in a different order than the sorting of the column.
The following code worked for me.
this.ultraGrid1.DisplayLayout.Bands[0].Columns["title"].SortComparer = new GroupsByOrderSorter();
public class GroupsByOrderSorter : IComparer
{
UltraGridCell yCell = y as UltraGridCell;
object yObject = yCell.Value;
return 0;
}