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

Can't get row drag & drop to work within a single grid

I'm trying to replicate the example in the documentation for re-ordering rows in a grid using drag & drop. When I run it, it lets me drag the row, but the drop handler is never called to save the data into the database.

I've attached my project. You'll need to add a few sample rows, as i didn't implement the basic row editing 'save' handler.

Attachment: SyncfusionMvcApplication6_de55d162.zip

6 Replies

JK Jayaprakash Kamaraj Syncfusion Team November 30, 2016 04:02 PM UTC

Hi Brain, 
Thank you for contacting Syncfusion support. 
If sorting operation is performed in Grid means we have prevented the row drag and drop event handler. Because, if you reorder a row when a column is sorted in Grid it will change the sorting behavior. So, we suggest you to set sortedColums as empty array in RowDragStart event of Grid. Please refer to the below code example 
//.Datasource(ds => .. 
.Columns(col => 
<script type="text/javascript"> 
    function rowdragstart(args) { 
        this.model.sortSettings.sortedColumns = []; 
Jayaprakash K. 

RB R Brian Lindahl December 1, 2016 08:56 PM UTC

Thanks - I see the point.

Would a better solution be to have the datasource pre-sorted, and just turn off sorting in the grid?

RB R Brian Lindahl December 1, 2016 10:03 PM UTC

I tried it without the .AllowSorting and .SortSettings, but it still doesn't work. Further suggestions?

JK Jayaprakash Kamaraj Syncfusion Team December 2, 2016 01:01 PM UTC

Hi Brian, 
We were unable to reproduce the issue at our end. Please refer to the below video. 

Please share the following information to find the cause of the issue.    
1.     Share the video to show the issue. 
2.     Is there any script error or exception thrown in your project? If so, attach the screenshot of your stack trace.    
3.     Attach screenshot of the POST request in Network tab of browser developer tool. Please expand the post request and share the screenshot. 
4.     Browser details.   
Jayaprakash K. 

RB R Brian Lindahl December 2, 2016 02:49 PM UTC

Tried it again this morning, and it does indeed work OK. Thanks for the help.

JK Jayaprakash Kamaraj Syncfusion Team December 5, 2016 11:11 AM UTC

Hi Brian,  
We are happy that the problem has been solved. 
Please get back to us if you need any further assistance.   
Jayaprakash K. 

Live Chat Icon For mobile
Up arrow icon