我想添加一個搜索過濾器到tablesorter,但唯一的小部件,我可以找到添加搜索所有列和每個單獨的列的搜索輸入。我只希望搜索所有列處於活動狀態,並禁用在單個列中搜索的功能。tablesorter小部件篩選任何匹配項。如何只搜索所有列(刪除個別列的搜索)
這是JS`$(函數(){
var $table = $('table').tablesorter({
theme: 'blue',
widgets: ["zebra", "filter"],
widgetOptions : {
// filter_anyMatch replaced! Instead use the filter_external option
// Set to use a jQuery selector (or jQuery object) pointing to the
// external filter (column specific or any match)
filter_external : '.search',
// add a default type search to the first name column
filter_defaultFilter: { 1 : '~{query}' },
// include column filters
filter_columnFilters: true,
filter_placeholder: { search : 'Search...' },
filter_saveFilters : true,
filter_reset: '.reset'
}
});
// make demo search buttons work
$('button[data-column]').on('click', function(){
var $this = $(this),
totalColumns = $table[0].config.columns,
col = $this.data('column'), // zero-based index or "all"
filter = [];
// text to add to filter
filter[ col === 'all' ? totalColumns : col ] = $this.text();
$table.trigger('search', [ filter ]);
return false;
});
});`
每一列中搜索輸入是什麼我想移除。
感謝您的幫助
謝謝。我非常驚訝,我錯過了。猜猜我昨晚盯着它太久了。 – Rob