We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

I have a flat datasource bounded to a ggc that is grouped by one column. How can I sort the ggc my the grouped caption?

I have a flat datasource bouded to a ggc that is grouped my one column. How can I sort the ggc by the grouped caption?
I think what I'm needing to do is to click on a column to perform a sort but instead sort my a different field.


2 Replies

AD Administrator Syncfusion Team March 12, 2008 05:04 AM UTC

Hi James,

Thank you for your interest in Syncfusion Products.

If your intension is to allow sorting only for the grouped columns, this can be achieved by handling the TableControlQueryAllowSortColumn event of GridGroupingControl.
Here is the code:


this.gridGroupingControl1.TableControlQueryAllowSortColumn += new Syncfusion.Windows.Forms.Grid.Grouping.GridQueryAllowSortColumnEventHandler(gridGroupingControl1_TableControlQueryAllowSortColumn);

void gridGroupingControl1_TableControlQueryAllowSortColumn(object sender, Syncfusion.Windows.Forms.Grid.Grouping.GridQueryAllowSortColumnEventArgs e)
{
if (e.Column.GetName() != "Col1")
{
e.AllowSort = false;
}

}

Please refer the sample in the link to illustrate this:
http://websamples.syncfusion.com/samples/Grid.Windows/72273/main.htm

Kindly try this and let me know if you need further assistance.

Regards,
Jisha





JA James March 19, 2008 03:07 AM UTC

This is NOT my intention.
Again, I have a flat datasource and that is grouped by a single column. That column appears in the caption row, next to the plus/minus cell. I want to be able to sort by that column


Loader.
Live Chat Icon For mobile
Up arrow icon