SortByColumn

Hi I have implemented ICompare for the sorting on the column in the GGC.

I am using the sentence as
this.dgAttributeAnalysis.TableModel.Data.SortByColumn(a, ListSortDirection.Descending, new CustomComparer());

But This is not calling Compare method in my CustomCompare class....Only constructor is execure on new CustomComparer() but Actual method is not getting executed.

please tell me where i am doing wrong....

3 Replies

AD Administrator Syncfusion Team April 11, 2007 02:34 PM UTC

Data.SortByColumn is a GridControlBase method that is only available in a GridControl that holds its own data in the Data object. It does not work in GridGroupingControl.

To sort a column in a GridGroupingControl, you create a SortColumnDescriptor and add it to the SortedColumns collection.

SortColumnDescriptor scd = new SortColumnDescriptor("Col1", ListSortDirection.Ascending);
scd.Comparer = new MyComparer();
gridGroupingControl1.TableDescriptor.SortedColumns.Add(scd);


HA Harshad April 11, 2007 03:20 PM UTC

Hi,

I have used SortColumnDescriptor as suggested.
But I am getting the 0 value always in compare method...not getting the cell value...
GridStyleInfoStore style1 = x as GridStyleInfoStore;
GridStyleInfoStore style2 = y as GridStyleInfoStore;
X & y Always coming as 0

Please tell me where i am doing wrong


HA haneefm Syncfusion Team April 11, 2007 04:04 PM UTC

Hi Harshad,

Here is a forum thread with a sample of a custom sort.

http://www.syncfusion.com/Support/Forums/message.aspx?MessageID=36995

Will this work for you?

Best regards,
Haneef

Loader.
Up arrow icon