我正在使用 Tablesorter Filter 来过滤多列表中的结果。目前,每一列都有自己的过滤器搜索框,您可以在demo中看到它。 。我想知道的是,是否可以只有一个过滤器搜索框来过滤每一列,就像 DataTables 插件中可能的那样(参见 here )?
最佳答案
使用这个quicksearch plugin与表排序器。应按如下方式初始化:
$('#search').quicksearch('table tbody tr');
如果您需要将其与寻呼机插件一起使用,那么您将需要以下初始化代码:
$('#search').quicksearch('table tbody tr', {
delay: 500,
show: function () {
$(this).removeClass('filtered');
$table.trigger('pageSet'); // reset to page 1 & update display
},
hide: function () {
$(this).hide().addClass('filtered');
$table.trigger('pageSet'); // reset to page 1 & update display
},
onAfter: function () {
// no need to update the table, just the pager, so use its namespace
$table.trigger('update.pager');
}
});
有一天我会把它构建成一个小部件,但同时注意 this issue thread 中的更新.
关于jQuery Tablesorter 过滤器 : Use only one filter search box for entire table?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18212881/