This is a migrated thread and some comments may be shown as answers.

Drag row over another row to merge

2 Answers 130 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Robert Madrian
Top achievements
Rank 1
Veteran
Iron
Robert Madrian asked on 22 Jan 2018, 04:11 PM

Hello,

How to use drag & drop to move a row over another in Kendo grid?

then I need the source row ID and the target row ID in the drop event where I will make an Ajax call to merge the rows into one at Service SQLServer table...

robert

2 Answers, 1 is accepted

Sort by
0
Viktor Tachev
Telerik team
answered on 25 Jan 2018, 12:18 PM
Hi Robert,

In order to implement the functionality you can use the Kendo Draggable widget to enable drag and drop in the Grid. The approach would be similar to the one in the example below. The example illustrates a feature using two Grids. However, in your  scenario you would use just one.


Then, add handler to the dragend event. In the event handler you can get the item that was dragged and the item that was the drop target. 


dragend: function(e) {
    var draggedItem = e.currentTarget;
    // this would be a grid cell
    var dropTarget = e.target;
    var dataItem = grid1.dataItem($(dropTarget).closest("tr"));
 
 
    // send ajax request to the server
 
},


Having that information you can use jQuery.ajax to call the relevant controller and pass the ids of the two items. 


Regards,
Viktor Tachev
Progress Telerik
Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0
Robert Madrian
Top achievements
Rank 1
Veteran
Iron
answered on 14 Feb 2018, 07:04 PM
Thank you - it works perfect...
Tags
Grid
Asked by
Robert Madrian
Top achievements
Rank 1
Veteran
Iron
Answers by
Viktor Tachev
Telerik team
Robert Madrian
Top achievements
Rank 1
Veteran
Iron
Share this question
or