使用jQuery tablesorter.js避免/禁用排序过程中的某些特定行
我有一个使用jquery插件tablesorter排序的表。 在这里,当选择任何列进行排序时,我希望避免第一行{class=“avoid sort”}被排序。 例如:使用jQuery tablesorter.js避免/禁用排序过程中的某些特定行,jquery,tablesorter,Jquery,Tablesorter,我有一个使用jquery插件tablesorter排序的表。 在这里,当选择任何列进行排序时,我希望避免第一行{class=“avoid sort”}被排序。 例如: # 购买日期 课程名称 金额(美元) 用户名 分享 净收入[$236.41] 总收入 236.41 1. 2013年1月3日 解决认证问题 50 Khushi Jha 35 33.69 2. 2013年1月3日 国旗证书 100 支付 70 67.67 3. 2013年1月3日 解决认证问题 50 支付 35 33.69
#
购买日期
课程名称
金额(美元)
用户名
分享
净收入[$236.41]
总收入
236.41
1.
2013年1月3日
解决认证问题
50
Khushi Jha
35
33.69
2.
2013年1月3日
国旗证书
100
支付
70
67.67
3.
2013年1月3日
解决认证问题
50
支付
35
33.69
tr class=“避免排序”不应出现在排序中 请帮忙 您有两个选择:
…
$(“表”).tablesorter({
小部件:['staticRow']
})
或者,您可以设置自定义类名:
…
$(“表”).tablesorter({
小部件:['staticRow'],
widgetOptions:{
//注意,它需要一个CSS选择器,而不是原始类名
staticRow_类:“.tablesorter static”
}
})
您不能使用jQuery:not()
?最重要的是,我遇到了这个问题,cssInfoBlock解决了这个问题。谢谢不客气!我的叉子也是一个版本的。这不是问题中所问的。您的答案将禁用索引为4和8的列的排序。提出的问题希望忽略对某些行(而不是列)的排序@阿卜杜勒·贾马尔
<thead>
<tr>
<th class="header">#</th>
<th class="header">Purchase Date</th>
<th class="header">Course Name</th>
<th class="header">Amount(in $)</th>
<th class="header">User Name</th>
<th class="header">Share</th>
<th class="header">Net Revenue [$236.41]</th>
</tr>
</thead>
<tbody>
<tr class="avoid-sort">
<th colspan="7">Total Revenue</th>
<td>236.41</td>
</tr>
<tr>
<td>1</td>
<td>January 3rd, 2013</td>
<td>Tackle Certification</td>
<td>50</td>
<td>Khushi Jha</td>
<td>35</td>
<td>33.69</td>
</tr>
<tr>
<td>2</td>
<td>January 3rd, 2013</td>
<td>Flag Certification</td>
<td>100</td>
<td>Pay</td>
<td>70</td>
<td>67.67</td>
</tr>
<tr>
<td>3</td>
<td>January 3rd, 2013</td>
<td>Tackle Certification</td>
<td>50</td>
<!-- <td>-->
<!--</td>-->
<td>Pay</td>
<td>35</td>
<td>33.69</td>
</tr>
<table>
<thead>
...
</thead>
<!-- rows within this tbody are ignored -->
<tbody class="avoid-sort">
<tr>
<th colspan="7">Total Revenue</th>
<td>236.41</td>
</tr>
</tbody>
<tbody>
<!-- sortable rows -->
<tr>
...
</tr>
</tbody>
</table>
$(function() {
$("table").tablesorter({
theme : 'blue',
cssInfoBlock : "avoid-sort",
widgets: [ 'zebra' ]
});
});
$(function() {
$("#myTable").tablesorter({
headers: {4: {sorter: false},8: {sorter: false}}
});
});