0
我使用tablesorter来排序我的表html表。有没有可能使用tablesorter获得列索引和排序顺序?在使用tablesorter执行排序时获取列索引和排序顺序?
我使用tablesorter来排序我的表html表。有没有可能使用tablesorter获得列索引和排序顺序?在使用tablesorter执行排序时获取列索引和排序顺序?
你能否分享一些关于何时需要这些信息的更多细节。
我写了这个答案,假设你想排序后的排序信息。在此示例中,仅被返回所述第一排序列信息,但所有排序列将包含内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'
});
});
的重复https://stackoverflow.com/questions/1955980/how-对获得电流排序顺序从 - 的tablesorter-插件 –