GGC: Sort by multiple columns

Hi,

What I want to accomplish is sorting by multiple columns. It seems that when I sort a ggc, it is only based on a specific column. That column is the column that I click the header of. I want to be able to sort based on multiple columns, one after another. Is this possible? If so, can you please provide an example?

Thank you.

1 Reply

HA haneefm Syncfusion Team October 3, 2007 05:03 PM UTC

Hi Patrick,


By default the multi column sort by Ctrl+Left Button Mouse Click is enabled. To enable/disable the multi column sort the AllowMultiColumnSort property must be set to true/false. Below is a code.

this.gridGroupingControl1.TableOptions.AllowMultiColumnSort = false;
From code to sort several columns, you add the columns the grid.TableDescriptor.SortedColumns collection.

this.gridGroupingControl1.TableDescriptor.SortedColumns.AddRange( new SortColumnDescriptor[ ]
{
new SortColumnDescriptor(colName1, ListSortDirection.Ascending),
new SortColumnDescriptor(colName2, ListSortDirection.Descending),
new SortColumnDescriptor(colName3, ListSortDirection.Ascending)
});

Best regards,
Haneef

Loader.
Up arrow icon