end

Fires when item dragging ends but before the item's position is changed in the DOM. This event is suitable for preventing the sort action.

Event Data

e.action String

Possible values are: "sort" - indicates that item's position was changed inside the same Sortable container; "remove" - indicates that the item was removed from current Sortable widget; "receive" - indicates that the item was received by a connected Sortable widget instance;

e.preventDefault Function

If invoked prevents the sort action. The element will be reverted at its original position. The hint and placeholder will be destroyed.

e.item jQuery

The element that is dragged.

e.oldIndex Number

The original position of the item in the Sortable collection. In case the item is received from connected Sortable the value will be -1

e.newIndex Number

The position where item will be placed. In case the item is removed from connected Sortable the value will be -1

e.draggableEvent Object

The original draggable's drag event data.

Example

<ul id="sortable">
    <li>Item1</li>
    <li>Item2</li>
    <li>Item3</li>
</ul>

<script>
    $("#sortable").kendoSortable({
        end: function(e) {
            console.log("from " + e.oldIndex + " to " + e.newIndex);

            //prevent first item to be placed at the end of the list
            if(e.newIndex == 2 && e.oldIndex == 0) {
                e.preventDefault();
            }
        }
    });
</script>
In this article
Not finding the help you need?