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.
Unfortunately, activation email could not send to your email. Please try again.

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

Thread ID:

Created:

Updated:

Platform:

Replies:

127636 Nov 29,2016 10:03 AM Dec 5,2016 06:11 AM ASP.NET MVC 6
loading
Tags: Grid
R Brian Lindahl
Asked On November 29, 2016 10:03 AM

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

Jayaprakash Kamaraj [Syncfusion]
Replied On November 30, 2016 11:02 AM

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 
 
@(Html.EJ().Grid<SyncfusionMvcApplication6.Models.Orderable>("GridContainer") 
//.Datasource(ds => .. 
 
 
.Columns(col => 
{ 
    col.Field("OrderID").HeaderText("ID").IsPrimaryKey(true).Add(); 
    col.Field("CustomerID").HeaderText("Name").Add(); 
    col.Field("EmployeeID").HeaderText("Order").Add(); 
}).ClientSideEvents(eve=>eve.RowDragStart("rowdragstart")) 
) 
<script type="text/javascript"> 
    function rowdragstart(args) { 
        this.model.sortSettings.sortedColumns = []; 
    } 
</script> 
 
Regards, 
 
Jayaprakash K. 


R Brian Lindahl
Replied On December 1, 2016 03:56 PM

Thanks - I see the point.

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

R Brian Lindahl
Replied On December 1, 2016 05:03 PM

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

Jayaprakash Kamaraj [Syncfusion]
Replied On December 2, 2016 08:01 AM

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.   
 
Regards, 
 
Jayaprakash K. 


R Brian Lindahl
Replied On December 2, 2016 09:49 AM

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

Jayaprakash Kamaraj [Syncfusion]
Replied On December 5, 2016 06:11 AM

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


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.

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.

;