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

Getting the row and column index based on mouse position for drag and drop rows functionality

Dear community

I am relatively new in using syncfusion controls, but i am aware that the drag and drop rows functionality is not set by default when using GridGroupingControl. Therefore i am trying to add this functionality on my own but my difficulty is how to determine the row index during the mouse events. 

Below is an example that works when using sfdatagrid

private void OnMouseDown(object sender, MouseEventArgs e)
            //Do your customization here
                IsMouseDown = true;
                Point p = new Point(e.X, e.Y);
                rowColIndex = sfDataGrid1.TableControl.PointToCellRowColumnIndex(p);
                mouseDownRecordIndex = this.sfDataGrid1.TableControl.ResolveToRecordIndex(rowColIndex.RowIndex);
            if (!(mouseDownRecordIndex < 0))
                if (ObjList.Count != 0)
                    selectedItem = ObjList[mouseDownRecordIndex];


My ObjList is my datasource which is a list of objects. Here we have methods like PointToCellRowColumnIndex and ResolveToRecordIndex. Are there any similar methods when using GridGroupingControl?

Thank you in advance.

2 Replies

MI Michael September 19, 2019 09:25 AM UTC

Update: Done it! :) 

Now i need to sort the datasource according to the sorting method of the column headers (Ascending, Descending).
I am currently doing it, but if you have any tips, please let me know.

Thank you again in advance.

AR Arulpriya Ramalingam Syncfusion Team September 20, 2019 08:36 AM UTC

Hi Michael,   
Thanks for using Syncfusion products.   
The GridGroupingControl has default support to sort the columns in ascending and descending order by adding the columns into the SortColumnDescriptor of the GridTableDescriptor. We have already documented the details to achieve the sorting in GridGroupingControl. Please make use of the below UG link.   
Please revert to us, if you have any other queries.   

Live Chat Icon For mobile
Up arrow icon