2016-10-13 47 views
0

如何使用可排序JQuery循環或獲取表中每行的數據。 我唯一能做的就是在排序行後獲取數據,但它只返回我拖動的行的索引。通過可排序行循環JQuery

這裏是代碼:

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

我想從編號字段循環之後的數據發生

Table Sort

回答

0

OMG我解決我自己的問題

我環路首先從表中使用每個函數的行然後我把它放在可排序的更新函數中

這裏是代碼

$('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 
      }); 
     } 

    }); 
})