Robert A. Robert A. - 1 month ago 7
jQuery Question

How to check current order of rows in sortable table?

Working on a project "sortable" (rows vertically :)) list of items, but I met the problem and I don't know how to solve it.

each row got own id. How can I check new order then save it into database so next time I will load data it will be displayed in "saved" order ?


Give the items a classname. When the items are sorted they will have the right order in the classnames-array. For example:

<div id="list">
   <div class="item">item 1</div>
   <div class="item">item 2</div>
   <div class="item">item 3</div>

    //save item[n] to your database using $.ajax