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. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

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

Thread ID:

Created:

Updated:

Platform:

Replies:

147672 Sep 19,2019 08:33 AM UTC Sep 20,2019 08:36 AM UTC WinForms 2
loading
Tags: GridGroupingControl
Michael
Asked On September 19, 2019 08:33 AM UTC

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.

Michael
Replied On 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.

Arulpriya Ramalingam [Syncfusion]
Replied On 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.   
   
Regards,   
Arulpriya   


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon