遍历可排序行 JQuery

Loop through Sortable Row JQuery

如何使用 Sortable JQuery 循环或获取 table 中每一行的数据。 我唯一能做的就是在对行进行排序后获取数据,但它只是 return 我拖动的行的索引。

这是代码:

$('document').ready(function(){
     $('tbody').sortable({
          update: function(event, ui) {
          //i want to do the looping here
          }
     })
});

我想在循环发生后从编号字段中获取数据

天啊我解决了我自己的问题

我首先使用每个函数循环 table 中的行,然后将其放入 sortable

的更新函数中

这是代码

$('document').ready(function(){
    $('tbody').sortable({
        update: function(event, ui) {
            //loop data

            $('tbody:first th').each(function() {
                var data = $(this).html();
               // alert(data);
            
                //do the saving here
            });
        }

    });
})