2014-07-13 61 views

回答

1

你能否分享一些關於何時需要這些信息的更多細節。

我寫了這個答案,假設你想排序後的排序信息。在此示例中,僅被返回所述第一排序列信息,但所有排序列將包含內table.config.sortList變量(demo):

$(function() { 
    $('table') 
    .on('sortEnd', function(){ 
     var currentSort = this.config.sortList, 
      firstColumn = currentSort[0][0], 
      firstColumnDirection = currentSort[0][1] === 0 ? 'Ascending' : 'Descending'; 
     console.log('column = ' + firstColumn, ', direction = ' + firstColumnDirection); 
    }) 
    .tablesorter({ 
     theme: 'blue' 
    }); 
}); 
相關問題