Edit this page

Get Data Index in the ListBox after Reordering

Environment

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

 

Description

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.

Is this article helpful? Yes / No
Thank you for your feedback!

Give article feedback

Tell us how we can improve this article

close
Dummy