【发布时间】:2014-10-08 12:57:32
【问题描述】:
我的网站上有很多使用 tablesorter 的表格,我正在寻找一种方法来对“sorter: 'digit' a column that has a specific classname: "class="note" 进行排序。
我知道用标题来做到这一点:
$(".tablesorter").tablesorter({
headers: {
0: { sorter: 'digit' } // column number, type
} });
但是有没有一种通用的方法是这样的html:
<th class="{sorter: 'digit'}">Note</th>
或者像这样在javascript中的某个地方使用类名<th class="note">Note</th>
$(".tablesorter .note").tablesorter() ...
?
因为我的“注释”栏有时是第三栏,有时是第五栏,等等。
我问这个是因为没有指定“数字”顺序,tablesorter 不知道如何对数字进行排序......这里是 un jsfiddle 来说明我的意思:http://jsfiddle.net/2cmuy39L/
谢谢。
【问题讨论】: