Reputation: 1550
I'm using Tablesorter Filter to filter results in a multi-column table. Currently, each column has its own filter search box, which you can see in the demo. What I'm wondering is, is it possible to have only a single filter search box that filters for every column, like what's possible in the DataTables plugin (seen here)?
Upvotes: 2
Views: 1356
Reputation: 86403
Use this quicksearch plugin with tablesorter. It should be initialized as follows:
$('#search').quicksearch('table tbody tr');
If you need to use it with the pager plugin, then you'll need this initialization code:
$('#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');
}
});
Someday I'll build this into a widget, but in the mean time watch for updates in this issue thread.
Upvotes: 1