how to reorder row and scroll at same time in kendo grid ui

664 views Asked by At

I have used kendo sortable to drag and drop row to reorder.

javascript:

grid.table.kendoSortable({
        filter: ">tbody >tr",
        hint: function (element) { 
            var table = $('<table style="width: 600px;" class="k-grid k-widget"></table>'),
                hint;

            table.append(element.clone()); 
            table.css("opacity", 0.7);

            return table; 
        },
        cursor: "move",
        placeholder: function (element) {
            return $('<tr colspan="4" class="placeholder"></tr>');
        }
        ,
        change: function (e) {
            var skip = grid.dataSource.skip(),
                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);
        }
    });

I cant not scroll and drag at the same time. scrolling to working while dragging. How to solve it??

1

There are 1 answers

1
Carsten Franke On

Last year or so, they've added a new setting: autoScroll which does the trick. See https://docs.telerik.com/kendo-ui/api/javascript/ui/sortable/configuration/autoscroll for the documentation.