Kendo Sortable - 将项目留在列表中

时间:2015-08-20 19:39:57

标签: asp.net-mvc kendo-ui kendo-asp.net-mvc

我正在使用Kendo Sortable。我想从一个列表中拖动一个项目以填充另一个,但我需要将该项目保留在原始列表中。有没有人知道如何做到这一点?

1 个答案:

答案 0 :(得分:2)

可排序的替代方案可能是可拖动的& DropTarget的。

查看Moving items from one list to another

$("#listB").kendoDropTarget({
    dragenter: addStyling,
    dragleave: resetStyling,
    drop: function(e) { //apply changes to the data after an item is dropped
        var draggableElement = e.draggable.currentTarget,
        dataItem = listA_DS.getByUid(draggableElement.data("uid")); //find the corresponding dataItem by uid


        //--- Change --- listA_DS.remove(dataItem); //remove the item from ListA
        listB_DS.add(dataItem); //add the item to ListB

        resetStyling.call(this); //reset visual dropTarget indication that was added on dragenter
    }
});

Modified Example from that page