diff --git a/docs/example-widget-filter-any-match.html b/docs/example-widget-filter-any-match.html index f6b80656..16396572 100644 --- a/docs/example-widget-filter-any-match.html +++ b/docs/example-widget-filter-any-match.html @@ -2,14 +2,14 @@ - jQuery plugin: Tablesorter 2.0 - Filter Widget Any Match + jQuery plugin: Tablesorter 2.0 - Filter Widget External Search - + - - + + @@ -26,52 +26,60 @@ theme: 'blue', widgets: ["zebra", "filter"], widgetOptions : { - // if true overrides default find rows behaviours and if any column matches query it returns that row - filter_anyMatch : true, - filter_columnFilters: false, + // 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', + // include column filters + filter_columnFilters: true, + filter_saveFilters : true, filter_reset: '.reset' } }); - // Target the $('.search') input using built in functioning - // this binds to the search using "search" and "keyup" - // Allows using filter_liveSearch or delayed search & - // pressing escape to cancel the search - $.tablesorter.filter.bindSearch( $table, $('.search') ); - - // Basic search binding, alternate to the above - // bind to search - pressing enter and clicking on "x" to clear (Webkit) - // keyup allows dynamic searching - /* - $(".search").bind('search keyup', function (e) { - $('table').trigger('search', [ [this.value] ]); - }); - */ - });
-

- NOTE! +

+
+
+ +

Notes

+
    -
  • This is a demo of the filter_anyMatch option (v2.13.3).
  • -
  • This method has limitations in that it does not support all of the per column search features! So, at this time, the following types of queries are not allowed as the results will cause confusion: +
  • This is a demo of the filter_external option (added v2.15).
  • +
  • In v2.15 +
      +
    • The filter_anyMatch has been removed (added v2.13.3; removed in v2.15)
    • +
    • A new option filter_external has been added. It is set to a jQuery selector string ('.search') or jQuery object ($('.search')) targetting an external input.
    • +
    • So now a table can include both a filter row (filter_columnFilters is true, i.e. the internal table filters) and any number of external search inputs (as set by the filter_external option).
    • +
    • The external search results must have a data-column="#" attribute set, where # is the index of the column (zero-based) that the input targets, to have an input search all table content, set the data column attribute to "all" to match any column.
    • +
    • The $.tablesorter.bindSearch function (see demo) does exactly the same thing as the filter_external option. The major difference is seen when using ajax to populate the table, the initial filter values can be set before tablesorter initialization when using teh filter_external option; whereas, the bind search function can not set initial filter values and is usually executed after tablesorter initialization.
    • +
    +
  • +
+
+ +

Limitations

+
+
    +
  • The any-match search method has limitations applied. It does not support all of the per column search features! So, at this time, the following types of queries are not allowed as the results will cause confusion:
    • Search operators - A search for values equal, greater or less than values (> >= <= <) is not allowed because tables that contain both numbers and text (in separate columns). For example:
      "Fred" > "1"  // true*
      -"Fred" < "10" // false
      -"Fred" > 1    // false (numeric comparisons occur with parsed table data)
      -"Fred" > 1    // false
      -"Fred" < 10   // false
      * For comparisons, letters have a greater ASCII value than numbers. +"Fred" < "10" // false +"Fred" > 1 // false (numeric comparisons occur with parsed table data) +"Fred" > 1 // false +"Fred" < 10 // false* For comparisons, letters have a greater ASCII value than numbers.
    • Range query - A search for any number range (1 - 10) is not allowed because, if any columns contain text, then no rows will result. The examples are the same as the search operators examples above.
    • Not Match query - A search for not matches (!a) is not allowed because tables that contain both numbers and text (in separate columns) will always show all rows. For example: @@ -91,15 +99,19 @@ columns[5] = '2?%'; $('table').trigger('search', [ columns ]);
    -

    +
+
+

Demo

-
- - +
(Match any column)
+ (First Name)
- + + + +
diff --git a/docs/example-widget-filter.html b/docs/example-widget-filter.html index c8cc75e2..2d346a56 100644 --- a/docs/example-widget-filter.html +++ b/docs/example-widget-filter.html @@ -5,11 +5,11 @@ jQuery plugin: Tablesorter 2.0 - Filter Widget - + - - + + @@ -24,15 +24,6 @@ - -
Rank