lin*_*don 3 tablesorter filterfunction
有没有一种方法可以通过表排序器jquery语法添加数据占位符值,而不是添加到HTML标记本身?也许使用标题语法(如filter):false?
有五种禁用列过滤器(demo)的方法:
HTML(显示3种方式)
<table class="tablesorter">
<thead>
<tr>
<th>AlphaNumeric</th>
<th class="filter-false">Numeric</th> <!-- class name -->
<th class='{ "filter": false }'>Numeric2</th> <!-- meta data (requires metadata plugin) -->
<th data-filter="false">Animals</th> <!-- data-attribute -->
<th>Sites</th>
</tr>
</thead>
<tbody>
...
</tbody>
</table>
Run Code Online (Sandbox Code Playgroud)
脚本(显示2种方式)
$(function(){
// jQuery data (Sites column)
$('table').find('th:eq(4)').data('filter', false);
$('table').tablesorter({
theme: 'blackice',
headers: {
0: { filter: false } // headers option (Alphanumeric column)
},
widgets: ['zebra', 'filter']
});
});
Run Code Online (Sandbox Code Playgroud)
糟糕,对不起,我很累;漫长的一天。要将占位符添加到过滤器,请使用以下两种方法之一:
<th data-placeholder="Enter something...">AlphaNumeric</th>
Run Code Online (Sandbox Code Playgroud)
或使用脚本
// target the column using eq(0), where the number is a zero-based index of the column
$('.tablesorter th:eq(0)').data('placeholder', 'Enter something...');
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1315 次 |
| 最近记录: |