如何在Kendo Grid UI中同时对行和滚动进行重新排序

时间:2019-03-13 09:25:38

标签: kendo-grid kendo-sortable

我使用kendo sortable来拖放行以重新排序。

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);
        }
    });

我不能同时滚动和拖动。拖动时滚动到工作状态。如何解决??

1 个答案:

答案 0 :(得分:0)

去年左右,他们添加了一个新设置:autoScroll。有关文档,请参见https://docs.telerik.com/kendo-ui/api/javascript/ui/sortable/configuration/autoscroll