- Home
- Forum
- ASP.NET MVC
- Can't get row drag & drop to work within a single grid
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
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
SIGN IN To post a reply.
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
|
@(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.
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?
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.
Regards,
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.
Regards,
Jayaprakash K.
SIGN IN To post a reply.
- 6 Replies
- 2 Participants
-
RB R Brian Lindahl
- Nov 29, 2016 03:03 PM UTC
- Dec 5, 2016 11:11 AM UTC