New to Kendo UI for jQuery? Download free 30-day trial

Get Data Index in the ListBox after Reordering


Product Progress® Kendo UI® ListBox for jQuery
Operating System Windows 10 64bit
Browser IE For PC
Browser Version 11



How can I easily retrieve the index of each data item after reordering the ListBox? 

Suggested Workarounds

The ListBox does not provide a built-in solution for achieving this behavior. However, you can still work around this issue by applying custom logic on the reorder event of the ListBox.

The Kendo UI dataSource features the indexOf method but the data items are not automatically reordered in the dataSource after the reordering takes place. To retrieve the index of a specific ListBox data item, manually remove the item from its current and insert it in its desired position. When the indexes of the dataSource items match the order in the ListBox, then the indexOf method returns the correct index.

For more information on the API settings, refer to the documentation on the insert and indexOf methods.  

For a working demo, refer to this example. Although the demo uses the jQuery version, the logic applies client-side methods and the implementation for the AngularJS version is similar.

See also

Get Data Index in the ListBox on Add

In this article