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
close icon

ggc only sorting one way (ascending) and not the other way (descending)

I have a ggc with a checkbox in the first column (header and records). When I click the any column in the header to sort, the ggc sorts by that column in ascending order. However, when I click the header again, the ggc will not sort in descending order. What gives?

4 Replies

AD Administrator Syncfusion Team December 28, 2006 07:33 AM UTC

Hi James,

Please try to provide us some more information on this issue. I tried to reproduce the issue, but couldn't. kindly provide us a sample to reproduce the issue or modify any broswer sample accordingly.

Thanks for your patience.

Regards,
Haneef


JB James Blibo December 28, 2006 03:25 PM UTC

This grid is part of a larger project, so I just pull out the relevant code that affects this grid. I've attached the code.

I ggc basically have a checkbox in the first column (header and rows). This is a bounded column from the datasource. I'm also using a custom user control celltype as a dropdown from from one of your samples in the grid.

The ggc would just sort in one direction and not the other for each column.

ggc8.zip


JB James Blibo December 29, 2006 03:37 AM UTC

Ok! I think I firgure out what's going on!

I am handling the fllw events in the grid...

this.gridGroupingControl2.QueryCellStyleInfo += new GridTableCellStyleInfoEventHandler(gridGroupingControl2_QueryCellStyleInfo);
this.gridGroupingControl2.SaveCellText += new Syncfusion.Windows.Forms.Grid.GridCellTextEventHandler(gridGroupingControl2_SaveCellText);
this.gridGroupingControl2.TableControlCellClick += new Syncfusion.Windows.Forms.Grid.Grouping.GridTableControlCellClickEventHandler(gridGroupingControl2_TableControlCellClick);
this.gridGroupingControl2.TableControl.MouseUp += new MouseEventHandler(TableControl_MouseUp);
this.gridGroupingControl2.TableControlCheckBoxClick += new Syncfusion.Windows.Forms.Grid.Grouping.GridTableControlCellClickEventHandler(gridGroupingControl2_TableControlCheckBoxClick);
this.gridGroupingControl2.TableControlCurrentCellMoving += new GridTableControlCurrentCellMovingEventHandler(gridGroupingControl2_TableControlCurrentCellMoving);


However, when I comment out the TableControl_MouseUp event, the grid now sorts in both direction.

However, I am using the TableControl_MouseUp event because I saw this in an example on this forum about having a checkbox in the header column. Will commenting out this code just to make sorting in both direction works means that the checkbox in the header NOT worked?


AD Administrator Syncfusion Team January 4, 2007 09:09 AM UTC

Hi James,

Thank you for being patience.

The reason for this issue is because the TableControlMouseUp event has been handled for all columns. You can avoid this by checking for the checkbox column and according raising the MouseUp for the respective cell renderer. The following is the code snippet

>>>>>>>>>>Code Snippet<<<<<<<<<<<<<
private void TableControl_MouseUp(object sender, MouseEventArgs e)
{
int row, col;
this.gridGroupingControl1.TableControl.PointToRowCol(new Point(e.X, e.Y), out row, out col);
GridTableCellStyleInfo style = this.gridGroupingControl1.TableControl.Model[row, col];
if(style.TableCellIdentity.Column.MappingName.Equals("Col3")) // Col3 is CheckBox column
{
IMouseController controller;
this.gridGroupingControl1.TableControl.MouseControllerDispatcher.HitTest(new Point(e.X, e.Y), e.Button, e.Clicks, out controller);
if(controller.Name == "DragGroupHeader")
{
this.gridGroupingControl1.TableControl.GetCellRenderer(row, col).RaiseMouseUp(row, col, e);
}
}
}
>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<

Please let us know if you need any further assistance.
Have a nice day.

Best regards,
Madhan

Loader.
Live Chat Icon For mobile
Up arrow icon