Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function EnableDragAndDropForGrid() {
- let grid = $('#grid').data('kendoGrid');
- console.log(grid)
- grid.lockedTable.kendoSortable({
- filter: ">tbody >tr",
- hint: function(element) {
- var unlockedPortion = grid.table.find("tr[data-uid=" + element.data("uid") + "]").children();
- let table = $('<table style="width: 600px;" class="k-grid k-widget"></table>'),
- hint;
- table.append(element.clone().append(unlockedPortion));
- table.css("opacity", 0.7);
- return table;
- },
- cursor: "move",
- placeholder: function(element) {
- return $('<tr colspan="4" class="placeholder"></tr>');
- },
- change: function(e) {
- let skip = grid.dataSource.skip(),
- oldIndex = e.oldIndex + skip,
- newIndex = e.newIndex + skip,
- data = grid.dataSource.data(),
- dataItem = grid.dataSource.getByUid(e.item.data("uid"));
- grid.dataSource.remove(dataItem);
- grid.dataSource.insert(newIndex, dataItem);
- }
- });
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement