Robert A. Robert A. - 1 year ago 68
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 ?

Answer Source

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
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download