开发者

Sorting a tables first column after using jQuery UI's sortable?

开发者 https://www.devze.com 2022-12-14 05:39 出处:网络
I got a table which uses jQuery UI\'s sorta开发者_如何学Cble. The first column contains the order number of each row. How do I automatically sort the numbers (in ascending order) in the first column w

I got a table which uses jQuery UI's sorta开发者_如何学Cble. The first column contains the order number of each row. How do I automatically sort the numbers (in ascending order) in the first column when I sort the rows? This means that only the numbers in the first column will be sorted.

Thanks in advance!


var position = 1;

$('table tbody tr').each(function () {
    $('td:first', $(this)).text(position);
    position += 1;
});

You can put this function that occurs when sorting is done (it's "stop" for sortables UI)

0

精彩评论

暂无评论...
验证码 换一张
取 消