新しいカテゴリでクイック検索を無効にしてから再度有効にする必要があります (更新されたデモ)。最初に次のようにクイックサーチを設定します。
/**
* Filter the table.
* Resource: https://github.com/riklomas/quicksearch
*/
var quickSearchOptions = {
show: function () {
$(this).show().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 () {
$('table').trigger('update.pager');
}
};
$('.search').quicksearch('table tbody tr', quickSearchOptions);
次に、カテゴリを選択したら、クイックサーチを無効にしてから再度有効にします。
/**
* Show the corresponding contents when a category is clicked.
* Resource: http://tinyurl.com/jvneeey
*/
$('ul').on('click', 'li', function () {
var filters = [],
$t = $(this),
col = $t.data('filter-column'), // zero-based index
txt = $t.data('filter-text') || $t.text(); // text to add to filter
filters[col] = txt;
// using "table.hasFilters" here to make sure we aren't targetting a sticky header
$.tablesorter.setFilters($('table.hasFilters'), filters, true); // new v2.9
// disable previous quicksearch
$('.search')
.off('keyup')
.quicksearch('table tbody tr:not(.filtered)', quickSearchOptions);
});