I cannot find in the JQUI documentation how to display the sort order. What I want to do is display the sort order i.e. 1,2,3, 4, etc as a visual reference for a user. The sort order obviously updates on a sort, just not sure how to find/get the sort order - Oh I'm not sorting <li>'s
Add a comment
|
2 Answers
You can use the toArray method of sortables:
https://api.jqueryui.com/sortable/#method-toArray
Assuming this is your sortable, you can use the following code to retrieve an array of DOM IDs of the sortable's items in sort order:
var arrayOfIds = $(this).sortable("toArray")
Use it in the Stop event handler to update a display, like Andrew suggested. Check the linked documentation if you want to retrieve another attribute rather than the ID.