I'm able to drag rows within the kendo ui grid. Seperately able to drag rows outside the grid to another html element.
Is it possible to do both at same time?
For within grid:
Draggable within the grid:
grid.table.kendoSortable({
filter: ">tbody >tr",
cursor: "move",
hint: function(element) {
return $('<div class="k-grid k-widget"><table><tbody><tr>' + element.html() + '</tr></tbody></table></div>');
},
container: ".etr-watchlist_grid tbody",
change: function(e) {
let oldIndex = e.oldIndex,
newIndex = e.newIndex,
data = grid.dataSource.data(),
dataItem = grid.dataSource.getByUid(e.item.data("uid"));
grid.dataSource.remove(dataItem);
grid.dataSource.insert(newIndex, dataItem);
}
});
Drag outside the Grid:
$(".myGrid table tbody > tr").kendoDraggable({
group: "gridGroup",
threshold: 100,
hint: function(e) {
return $('<div class="k-grid k-widget"><table><tbody><tr>' + e.html() + '</tr></tbody></table></div>');
}
});
$(".dropHere").kendoDropTarget({
group: "gridGroup",
drop: function(e) {
e.draggable.hint.hide();
var txt = '';
$(e.draggable.element[0]).find("td").each(function(idx, td){
txt += $(td).text() + '\n';
});
e.dropTarget.text(txt);
}
});
});