diff --git a/docs/example-widget-filter.html b/docs/example-widget-filter.html index 320f3844..6b4ccb70 100644 --- a/docs/example-widget-filter.html +++ b/docs/example-widget-filter.html @@ -58,6 +58,10 @@ // css class applied to the table row containing the filters & the inputs within that row filter_cssFilter : 'tablesorter-filter', + // add custom filter elements to the filter row + // see the filter formatter demos for more specifics + filter_formatter : null, + // add custom filter functions using this option // see the filter widget custom demo for more specifics on how to use this option filter_functions : null, @@ -69,6 +73,9 @@ // Set this option to false to make the searches case sensitive filter_ignoreCase : true, + // if true, search column content while the user types (with a delay) + filter_liveSearch : true, + // jQuery selector string of an element used to reset the filters filter_reset : 'button.reset', @@ -76,6 +83,10 @@ // every character while typing and should make searching large tables faster. filter_searchDelay : 300, + // if true, server-side filtering should be performed because client-side filtering will be disabled, but + // the ui and events will still be used. + filter_serversideFiltering: false, + // Set this option to true to use the filter to find text from the start of the column // So typing in "a" will find "albert" but not "frank", both have a's; default is false filter_startsWith : false, @@ -186,14 +197,16 @@ $(function(){
filter_childRows : false
- if true, filter includes child row content in the search.filter_columnFilters : true
- if true, a filter will be added to the top of each table column.filter_cssFilter : 'tablesorter-filter'
- css class name added to the filter row & each input in the row.filter_formatter : null
- add custom filter elements to the filter row.filter_functions : null
- add custom filter functions using this option.filter_hideFilters : false
- if true, filters are hidden initially, but can be revealed by clicking on the filter icon.filter_ignoreCase : true
- if true, make all searches case-insensitive.filter_liveSearch : true
- if true, search column content while the user types (with a delay).filter_reset : null
- jQuery selector string of an element used to reset the filters.filter_searchDelay : 300
- typing delay in milliseconds before starting a search.filter_serversideFiltering : false
- if true, filter will be done server-side. The client-side filtering will be disabled, but the ui and events will still be used..filter_startsWith : false
- if true, filter start from the beginning of the cell contents.filter_useParsedData : false
- filter all data using parsed content.filter_serversideFiltering : false
- if true, server-side filtering should be performed because client-side filtering will be disabled, but the ui and events will still be used.cssIcon
option to an empty string.{content}
and {icon}
.{content}
will be replaced by the current header HTML content.onRenderHeader
function is called. New! v2.7.
+ This function is called after the template string has been built, but before the template string is applied to the header and before the onRenderHeader
function is called (v2.7).
onRenderTemplate
function receives a column index and template string parameters. The template string, from the headerTemplate
option, will already have the {icon}
and {content}
tags replaced; it's just a string of formatted HTML. When done manipulating this string, return it. Here is an example:
@@ -1604,7 +1605,7 @@ $(function(){
filter_formatter
option.filter_searchDelay
option New! v2.9.
+ filterReset -Trigger the filter widget to reset the search criteria. New! v2.7.7. + Trigger the filter widget to reset the search criteria (v2.7.7). If you are using thefilter_formatter
option to add custom input elements, this function may not work on those columns. Please refer to thefilter_formatter
section for more details.$(function(){ @@ -2834,7 +2849,7 @@ or, directly add the search string to the filter input as follows:saveSortReset -Trigger the saveSort widget to clear any saved sorts for that specific table. New! v2.7.11. + Trigger the saveSort widget to clear any saved sorts for that specific table (v2.7.11). $(function(){ $('button').click(function(){ @@ -2853,7 +2868,7 @@ or, directly add the search string to the filter input as follows:pageSize -Trigger the pager to change the page size. New! v2.7.4. + Trigger the pager to change the page size (v2.7.4). $(function(){ $('table').trigger('pageSize', 15); @@ -2863,7 +2878,7 @@ or, directly add the search string to the filter input as follows:pageSet -Trigger the pager to change the current page. New! v2.7.7. + Trigger the pager to change the current page (v2.7.7). $(function(){ $('table').trigger('pageSet', 3); diff --git a/js/jquery.tablesorter.widgets.js b/js/jquery.tablesorter.widgets.js index c4c8bd1b..f4e530a7 100644 --- a/js/jquery.tablesorter.widgets.js +++ b/js/jquery.tablesorter.widgets.js @@ -291,6 +291,7 @@ ts.addWidget({ filter_functions : null, // add custom filter functions using this option filter_hideFilters : false, // collapse filter row when mouse leaves the area filter_ignoreCase : true, // if true, make all searches case-insensitive + filter_liveSearch : true, // if true, search column content while the user types (with a delay) filter_reset : null, // jQuery selector string of an element used to reset the filters filter_searchDelay : 300, // typing delay in milliseconds before starting a search filter_startsWith : false, // if true, filter start from the beginning of the cell contents @@ -585,7 +586,7 @@ ts.addWidget({ }) .find('input.' + css).bind('keyup search', function(e, filter){ // ignore arrow and meta keys; allow backspace - if (e.type === 'keyup' && ((e.which < 32 && e.which !== 8) || (e.which >= 37 && e.which <=40))) { return; } + if (e.type === 'keyup' && ((e.which < 32 && e.which !== 8) || (e.which >= 37 && e.which <=40) || (e.which !== 13 && !wo.filter_liveSearch))) { return; } // skip delay if (typeof filter !== 'undefined' && filter !== true){ checkFilters(filter);