New to Kendo UI for jQueryStart a free 30-day trial

IndexOf

methods

Returns the index of specified item. Filtered items are excluded from the collection.

Important: While user drags to sort the original item is hidden and the placeholder is appended to the Sortable collection. This is why jQuery's index method might return incorrect results. When the developer wants to find the index of a given item it is recommended to use widget's indexOf method.

Parameters:elementjQuery

jQuery object which represents the sortable element.

Returns:Number

the index of specified item.

<div id="sortable">
    <h4>Sortable List</h4>
    <div>Item1</div>
    <div>Item2</div>
    <div>Item3</div>
</div>

<script>
    $("#sortable").kendoSortable({
        filter: ">div",
        move: function(e) {
            //NOTE: the heading element will be excluded from the
            //collection as it does not match the filter

            //shows the original position of the item
/* The result can be observed in the DevTools(F12) console of the browser. */
            console.log("index of item", this.indexOf(e.item));
            //shows the position where item will be moved to
/* The result can be observed in the DevTools(F12) console of the browser. */
            console.log("index of placeholder", this.indexOf(this.placeholder));
        }
    });
</script>
Not finding the help you need?
Contact Support