I am able to add rows, delete rows, and update my Kendo Grid via the CRUD operations in my controller. The issue I am having is that whenever I use the following drag and drop function the "remove()" triggers the Destroy event in my controller which deletes the row that was inserted and this is not what I am looking to do. The delete button is located in a column and only when this button is clicked do I want to trigger the Destroy event. My grid is editable and fully functional besides this issue which I have already spent a good amount of time trying to troubleshoot. Any help or work around for this matter would be greatly appreciated.
function onChange(e) {
var grid = $("#DropGrid").data("kendoGrid");
var oldIndex = e.oldIndex;
var newIndex = e.newIndex;
var data = grid.dataSource.data();
var dataItem = grid.dataSource.getByUid(e.item.data("uid"));
var numRows = grid.dataSource.view().length; //total # of rows
grid.dataSource.remove(dataItem); // <--- This is the line triggering the Destroy event.
grid.dataSource.insert(newIndex, dataItem);
}
function onChange(e) {
var grid = $("#DropGrid").data("kendoGrid");
var oldIndex = e.oldIndex;
var newIndex = e.newIndex;
var data = grid.dataSource.data();
var dataItem = grid.dataSource.getByUid(e.item.data("uid"));
var numRows = grid.dataSource.view().length; //total # of rows
grid.dataSource.remove(dataItem); // <--- This is the line triggering the Destroy event.
grid.dataSource.insert(newIndex, dataItem);
}