SteveInTN
SteveInTN

Reputation: 99

Kendo Sortable - Leave item in list

I am playing with using a Kendo Sortable. I would like to drag an item from one list in order to populate another, but I need to leave that item in the original list. Does anyone have an idea on how to do this?

Upvotes: 0

Views: 111

Answers (1)

Johan Carlsson
Johan Carlsson

Reputation: 81

An alternative to sortable might be draggable & dropTarget.

Have a look at 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

Upvotes: 2

Related Questions