gpt4 book ai didi

tablesorter - 在 jquery tablesorter 中添加过滤器数据占位符

转载 作者:行者123 更新时间:2023-12-01 11:44:22 26 4
gpt4 key购买 nike

有没有办法通过表排序器 jquery 语法添加数据占位符值,而不是添加到 th HTML 标记本身?也许使用像 filter: false 这样的 header 语法?

最佳答案

有五种方法可以禁用列过滤器 ( 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>

脚本(显示两种方式)

$(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']
});
});

抱歉,我累了;漫长的一天。要向过滤器添加占位符,请使用以下任一方法:

<th data-placeholder="Enter something...">AlphaNumeric</th>

或使用脚本

// 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...');

关于tablesorter - 在 jquery tablesorter 中添加过滤器数据占位符,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16741293/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com