Kendo grid multiple rows selection drag drop

1 Answer 824 Views
Drag and Drop Grid
Michele
Top achievements
Rank 1
Michele asked on 18 Jun 2021, 10:22 AM

Hi,

I need to select multiple rows in a kendo grid and  move them inside the grid to reorder them.

I'm using kendoSortable


grid.table.kendoSortable({ filter: ">tbody >tr", hint: function (element) { //customize the hintvar table = $( '<table style="width: 600px;" class="k-grid k-widget"></table>' ), hint; table.append(grid.select().clone()); //append the dragged element table.css("opacity", 0.7); return table; //return the hint element }, cursor: "move", placeholder: function (element) { return $('<tr colspan="4" class="placeholder"><td colspan ="' + grid.columns.length + '">Drop here</td></tr>'); }, change: function (e) { console.log(grid) var selectedId = []; grid.select().each(function(){ selectedId.push(this.getElementsByClassName('idCompOperation')[0].innerText); }); // do some stuff } });

 

In the change function I can get the multiple elements selected and change the order of them in the datasource but visually only the first column selected is moved in the table iven if I refresh the grid

 

Select 2 rows:

Drag to the beginning of the table

 

Just the first of the 2 rows is moved the other remains at the bottom

 

How can I do?

Thanks Mik

1 Answer, 1 is accepted

Sort by
0
Neli
Telerik team
answered on 23 Jun 2021, 09:01 AM

Hi Michele,

I would suggest you take a look at the Forum thread linked below where dragging multiple rows in Kendo Grid is discussed.

https://www.telerik.com/forums/drag-and-drop-reordering

In the thread there is also a solution using Kendo Draggable suggested:

https://www.telerik.com/forums/drag-and-drop-reordering#2643654

I hope you will find it helpful. 

Regards,
Neli
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Tags
Drag and Drop Grid
Asked by
Michele
Top achievements
Rank 1
Answers by
Neli
Telerik team
Share this question
or