Can I disable column sort for the group by column??
I grouped by "A" Column and when I click the header of "A" column, all groups are sorted and scroll bar also moved.
I want to disable only "A" column sorting.
got the solution
I have changed MyComp class something like as follow
class MyComp : IComparer { public int Compare(object x, object y) { public int Compare(object xObj, object yObj) {
UltraGridGroupByRow x = (UltraGridGroupByRow)xObj; UltraGridGroupByRow y = (UltraGridGroupByRow)yObj;
return -- my comparison check here on which I wanted to order grouped column;
}
Hello Ivaylo Petrov,
I am having similar kind of issue,
I have one UltraWinGrid (say ultraGrid1) in which suppose I have Col1, Col2, Col3.
and suppose I have 5 rows which are bind to this grid.
Col1 Col2 Col3A 1 BBB Random A 2 RRR Random A 3 BBB Random A 4 CCC Random A 5 AAA Random
Now I want to group this UltraGrid By Col2 programatically but after grouping I don't want to sort Col2 rows (neither ascending/descending), I want to take col2 group order as it is currently present in the table.
I want to view data like below
+ BBB (2 items)
+ RRR (1 items)
+ CCC (1 items)
+ AAA (1 items)
I tried by following way but its by default getting sorted initially in descending order
like
but I want result as earlier one.
(
)
following is my code snippet ->
this.ultraGrid1.DataSource = GenerateDataSet(); UltraGridColumn c = ultraGrid1.DisplayLayout.Bands[0].Columns["col2"]; this.ultraGrid1.DisplayLayout.Bands[0].SortedColumns.Add(c, false, true); c.GroupByComparer = new MyComp();
______________________________
class MyComp : IComparer
{ public int Compare(object x, object y) { return 0; } }
Please help me out on this.
Thanks in advance
this.ultraGrid1.DataSource = GenerateDataSet(); UltraGridColumn c = ultraGrid1.DisplayLayout.Bands[0].Columns["col1"]; this.ultraGrid1.DisplayLayout.Bands[0].SortedColumns.Add(c, false, true); c.GroupByComparer = new MyComp();
Hello JungHyuk,
I am checking about the progress of this issue.
Let me know if you need any further assistance.
Thank you for using Infragistics Components!
Thank you for contacting Infragistics!
What you could do in order to prevent sorting of a particular GroupbyColumn is to create your own class implementing IComparer interface and to assign instance of this class to GroupByComparer property to that column. This property is used specifying a custom comparer to sort group-by rows.
http://help.infragistics.com/doc/WinForms/2014.1/CLR4.0/?page=Infragistics4.Win.UltraWinGrid.v14.1~Infragistics.Win.UltraWinGrid.UltraGridColumn~GroupByComparer.html
As you can see IComparer declares only one method Compare which returns -1, 0 or 1.
Setting the result of the method to return always zero, determines that all of the objects being compared are equal, which means that they won’t be sorted.
You can check the following page for more information regarding IComparer interface: http://msdn.microsoft.com/en-us/library/2y07t0wt(v=vs.110).aspx
I am sending you sample where I’ve implemented this suggestion for you for column “id”.
Please let me know if you have any further questions.