├── .editorconfig ├── .gitignore ├── CHANGELOG.md ├── FAQ.md ├── MIT-LICENSE.txt ├── README.md ├── bower.json ├── examples ├── filtertable-all-terms.html ├── filtertable-any-term.html ├── filtertable-existing-input.html ├── filtertable-ignore-class.html ├── filtertable-ignore-columns.html ├── filtertable-min-chars.html ├── filtertable-min-rows.html ├── filtertable-quick.html ├── filtertable-sample.html ├── filtertable-striping.html ├── index.html ├── samples-common.js └── samples-styles.css ├── filterTable.jquery.json ├── jquery.filtertable.js ├── jquery.filtertable.min.js └── package.json /.editorconfig: -------------------------------------------------------------------------------- 1 | # EditorConfig is awesome: http://EditorConfig.org 2 | 3 | # 4 | root = true 5 | 6 | # all files 7 | [*] 8 | end_of_line = lf 9 | insert_final_newline = true 10 | indent_style = space 11 | indent_size = 4 12 | charset = utf-8 13 | trim_trailing_whitespace = true 14 | 15 | # sass files 16 | [*.{scss,sass}] 17 | indent_size = 2 18 | 19 | # markdown 20 | [*.md] 21 | trim_trailing_whitespace = false 22 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # OS generated files # 2 | ###################### 3 | .DS_Store 4 | .DS_Store? 5 | ._* 6 | .Spotlight-V100 7 | .Trashes 8 | Icon? 9 | ehthumbs.db 10 | Thumbs.db 11 | 12 | # Codekit files 13 | config.codekit* 14 | .codekit-cache 15 | examples-codekit/ 16 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # jQuery.filterTable Change Log 2 | 3 | ## 1.5.7 4 | - Support for `quickListClear` option that appends a quick list link which clears the filter. 5 | 6 | ## 1.5.6 7 | - Fixed filtering to work for special characters `'`, `"`, and `\`. 8 | - Minor documentation updates. 9 | 10 | ## 1.5.5 11 | 12 | - The filtering should now trigger automatically on input on iOS. For some reason, Safari iOS triggers a `blur` event on field change but not `keyup` or other related events. 13 | - A new feature for extending the plugin (option `filterExpression`) has been added. The default is unchanged—the literal filter string. 14 | - To search for _any_ of multiple terms, set `filterExpression` to `filterTableFindAny` to perform an OR search which delimits on space or comma characters in the filter field. Thank you to [Lukas](https://github.com/superlukas) for the implementation. An example page is included. 15 | - To search for _all_ of multiple terms, set `filterExpression` to `filterTableFindAll` to perform an AND search which delimits on space or comma characters in the filter field. Note that the matching is per-cell not per row, so each cell must have all terms to match. An example page is included. 16 | - A new feature for ignoring columns is available via the `ignoreColumns` option. Provide an array of column numbers (0-indexed) to ignore those columns during filtering. The default is no columns are ignored. An example page is included. 17 | - A new feature for ignoring cells with a specific class is available via the `ignoreClass` option. Provide a class name to ignore those cells during filtering. The default is no classes are ignored. An exampled page is included. Thanks to [geda0](https://github.com/geda0) for the idea. 18 | - Added a `minChars` option, thanks to [Darius Kazemi](https://github.com/dariusk), which specifies the minimum number of characters a user must enter into the filter field before filtering occurs. Default is 1, meaning the moment the user begins to type, filtering will occur. 19 | - Merged [Pierre Rudloff](https://github.com/Rudloff)’s Bower support. 20 | - Merged [Jason](https://github.com/deadbeef404)’s `minRows` bug fix. 21 | - Added an FAQ file. 22 | 23 | ## 1.5.4 24 | 25 | - Added a return key trap to the input filter field so that pressing return in the field should not submit any forms the table may be within. 26 | - The `preventReturnKey` option (`true` by default) has been added to allow you to switch back to the previous behavior of allowing the return key to submit forms. 27 | 28 | ## 1.5.3 29 | 30 | - **There is a potentially significant change in functionality in this version.** While the documentation offered the `inputSelector` option, within the code it was implemented as `filterSelector`. This has been corrected to match the documentation. Note that if you were previously using the `filterSelector` option to overcome this issue, you will need to change it to `inputSelector` to use the feature with this version. 31 | 32 | ## 1.5.2 33 | 34 | - Added an `inputSelector` option, thanks to [Pratik Thakkar](https://github.com/pratikt), which specifies a selector for an existing element to use instead of creating a new filter input field. There are some caveats of which to be aware: 35 | - If the element doesn't exist, a filter input field will be created as normal. 36 | - Because of quick lists and other options, this setting will be ignored and the filter input field will be created as normal if the resolution of the `inputSelector` returns more than one element. 37 | 38 | ## 1.5.1 39 | 40 | - Added an `autofocus` option, thanks to [Robert McLeod](https://github.com/penguinpowernz), which is disabled by default. Note that autofocus is generally a bad idea for accessibility reasons, but if you do not need to be compliant or don't want to support accessibility users, it's a nice user experience option. 41 | 42 | ## 1.5 43 | 44 | - **There is a potentially significant change in functionality in this version.** The callback is now called every time the search query changes. Previously it was only called when the change was a non-empty query. That is, the callback is now called when the query is cleared too. 45 | - Additional features have been taken from [Tomas Celizna](https://github.com/tomasc)'s CoffeeScript-based fork: 46 | - The quick list items can now be something other than anchor tags. See the `quickListTag` and `quickListGroupTag` options. 47 | - The filter query field can now have a name attribute assigned to it. See the `inputName` option. 48 | - The class applied to visible rows is now user changeable. See the `visibleClass` option. 49 | - The options in the documentation have been ordered alphabetically for easier scanning. 50 | - The internal pseudo selector is now created appropriately according to the jQuery version. (Pseudo selector generation changed in jQuery 1.8) 51 | 52 | ## 1.4 53 | 54 | - Fixed a bug with filtering rarely showing rows that did not have a match with the search query. 55 | - Added example pages. 56 | - Improved inline documentation of the source code. 57 | 58 | ## 1.3.1 (in spirit) 59 | 60 | - Added minified version of the plugin (thanks [Luke Stevenson](https://github.com/lucanos)). 61 | 62 | ## 1.3 63 | 64 | - The functionality is not reapplied to tables that have already been processed. This allows you to call `$(selector).filterTable()` again for dynamically created data without it affecting previously filtered tables. 65 | 66 | ## 1.2 67 | 68 | - Changed the default container class to `filter-table` from `table-filter` to be consistent with the plugin name. 69 | - Made the cell highlighting class an option rather than hard-coded. 70 | 71 | ## 1.1 72 | 73 | - Initial public release. 74 | -------------------------------------------------------------------------------- /FAQ.md: -------------------------------------------------------------------------------- 1 | # jQuery.filterTable Frequently Asked Questions 2 | 3 | ## How do I keep the header and/or footer rows from disappearing on filter? 4 | 5 | Ensure your header row(s) are in `` tags, your data row(s) are in `
` tags, and your footer row(s) are in `` tags. The plugin only filters `tbody` rows, but if you do not specify `thead`, `tbody`, `tfoot`, the brower puts all of your rows in a `tbody` block. 6 | 7 | ## Why isn't the filtering showing up on small tables? 8 | 9 | The plugin will not show for tables with fewer than `8` rows by default. To have the filter feature always appear, set the `minRows` option accordingly. For example: 10 | 11 | $('table').filterTable({minRows: 0}); 12 | 13 | Or see the [minRows example page](http://sunnywalker.github.io/jQuery.FilterTable/examples/filtertable-min-rows.html). 14 | 15 | -------------------------------------------------------------------------------- /MIT-LICENSE.txt: -------------------------------------------------------------------------------- 1 | (The MIT License) 2 | 3 | Copyright (c) 2012 Sunny Walkerterm
filter term (string)table
table being filtered (jQuery object)This is a sample of the jQuery.FilterTable plugin which searchs for all of the terms instead of the literal term (a AND b). The term delimiters are comma (,) and space ( ).
17 |It's important to note that the term matching is per-cell, not per-row. That is, to match, each cell must have all of the terms.
18 |For example:
19 |# | 30 |President | 31 |Terms | 32 |Tenure | 33 |
---|---|---|---|
1 | George Washington | two | 1789-1797 |
2 | John Adams | one | 1797-1801 |
3 | Thomas Jefferson | two | 1801-1809 |
4 | James Madison | two | 1809-1817 |
5 | James Monroe | two | 1817-1825 |
6 | John Quincy Adams | one | 1825-1829 |
7 | Andrew Jackson | two | 1829-1837 |
8 | Martin Van Buren | one | 1837-1841 |
9 | William Henry Harrison | one-partial | 1841 |
10 | John Tyler | one-partial | 1841-1845 |
11 | James Knox Polk | one | 1845-1849 |
12 | Zachary Taylor | one-partial | 1849-1850 |
13 | Millard Fillmore | one-partial | 1850-1853 |
14 | Franklin Pierce | one | 1853-1857 |
15 | James Buchanan | one | 1857-1861 |
16 | Abraham Lincoln | two-partial | 1861-1865 |
17 | Andrew Johnson | one-partial | 1865-1869 |
18 | Ulysses S. Grant | two | 1869-1877 |
19 | Rutherford Birchard Hayes | one | 1877-1881 |
20 | James Abram Garfield | one-partial | 1881 |
21 | Chester Alan Arthur | one-partial | 1881-1885 |
22 | Grover Cleveland | one | 1885-1889 |
23 | Benjamin Harrison | one | 1889-1893 |
24 | Grover Cleveland | one-again | 1893-1897 |
25 | William McKinley | two-partial | 1897-1901 |
26 | Theodore Roosevelt | two-partial | 1901-1909 |
27 | William Howard Taft | one | 1909-1913 |
28 | Woodrow Wilson | two | 1913-1921 |
29 | Warren Gamaliel Harding | two-partial | 1921-1923 |
30 | Calvin Coolidge | two-partial | 1923-1929 |
31 | Herbert Clark Hoover | one | 1929-1933 |
32 | Franklin Delano Roosevelt | four-partial | 1933-1945 |
33 | Harry S. Truman | two-partial | 1945-1953 |
34 | Dwight David Eisenhower | two | 1953-1961 |
35 | John Fitzgerald Kennedy | two-partial | 1961-1963 |
36 | Lyndon Baines Johnson | two-partial | 1963-1969 |
37 | Richard Milhous Nixon | two-partial | 1969-1974 |
38 | Gerald Rudolph Ford | two-partial | 1974-1977 |
39 | James Earl Carter, Jr. | one | 1977-1981 |
40 | Ronald Wilson Reagan | two | 1981-1989 |
41 | George Herbert Walker Bush | one | 1989-1993 |
42 | William Jefferson Clinton | two | 1993-2001 |
43 | George Walker Bush | two | 2001-2009 |
44 | Barack Hussein Obama | one | 2009- |
Data as of October, 2012.
83 |$('table').filterTable({ 85 | filterExpression: 'filterTableFindAll' 86 | });87 | 88 | 89 | 95 | 96 | 97 | -------------------------------------------------------------------------------- /examples/filtertable-any-term.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 |
This is a sample of the jQuery.FilterTable plugin which searchs for any of the terms instead of the literal term (a OR b). The term delimiters are comma (,) and space ( ).
17 |For example:
18 |# | 27 |President | 28 |Terms | 29 |Tenure | 30 |
---|---|---|---|
1 | George Washington | two | 1789-1797 |
2 | John Adams | one | 1797-1801 |
3 | Thomas Jefferson | two | 1801-1809 |
4 | James Madison | two | 1809-1817 |
5 | James Monroe | two | 1817-1825 |
6 | John Quincy Adams | one | 1825-1829 |
7 | Andrew Jackson | two | 1829-1837 |
8 | Martin Van Buren | one | 1837-1841 |
9 | William Henry Harrison | one-partial | 1841 |
10 | John Tyler | one-partial | 1841-1845 |
11 | James Knox Polk | one | 1845-1849 |
12 | Zachary Taylor | one-partial | 1849-1850 |
13 | Millard Fillmore | one-partial | 1850-1853 |
14 | Franklin Pierce | one | 1853-1857 |
15 | James Buchanan | one | 1857-1861 |
16 | Abraham Lincoln | two-partial | 1861-1865 |
17 | Andrew Johnson | one-partial | 1865-1869 |
18 | Ulysses S. Grant | two | 1869-1877 |
19 | Rutherford Birchard Hayes | one | 1877-1881 |
20 | James Abram Garfield | one-partial | 1881 |
21 | Chester Alan Arthur | one-partial | 1881-1885 |
22 | Grover Cleveland | one | 1885-1889 |
23 | Benjamin Harrison | one | 1889-1893 |
24 | Grover Cleveland | one-again | 1893-1897 |
25 | William McKinley | two-partial | 1897-1901 |
26 | Theodore Roosevelt | two-partial | 1901-1909 |
27 | William Howard Taft | one | 1909-1913 |
28 | Woodrow Wilson | two | 1913-1921 |
29 | Warren Gamaliel Harding | two-partial | 1921-1923 |
30 | Calvin Coolidge | two-partial | 1923-1929 |
31 | Herbert Clark Hoover | one | 1929-1933 |
32 | Franklin Delano Roosevelt | four-partial | 1933-1945 |
33 | Harry S. Truman | two-partial | 1945-1953 |
34 | Dwight David Eisenhower | two | 1953-1961 |
35 | John Fitzgerald Kennedy | two-partial | 1961-1963 |
36 | Lyndon Baines Johnson | two-partial | 1963-1969 |
37 | Richard Milhous Nixon | two-partial | 1969-1974 |
38 | Gerald Rudolph Ford | two-partial | 1974-1977 |
39 | James Earl Carter, Jr. | one | 1977-1981 |
40 | Ronald Wilson Reagan | two | 1981-1989 |
41 | George Herbert Walker Bush | one | 1989-1993 |
42 | William Jefferson Clinton | two | 1993-2001 |
43 | George Walker Bush | two | 2001-2009 |
44 | Barack Hussein Obama | one | 2009- |
Data as of October, 2012.
80 |$('table').filterTable({ 82 | filterExpression: 'filterTableFindAny' 83 | });84 | 85 | 86 | 92 | 93 | 94 | -------------------------------------------------------------------------------- /examples/filtertable-existing-input.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 |
This is a sample of the jQuery.FilterTable plugin which uses an existing element to filter the table instead of creating its own.
21 |# | 26 |President | 27 |Terms | 28 |Tenure | 29 |
---|---|---|---|
1 | George Washington | two | 1789-1797 |
2 | John Adams | one | 1797-1801 |
3 | Thomas Jefferson | two | 1801-1809 |
4 | James Madison | two | 1809-1817 |
5 | James Monroe | two | 1817-1825 |
6 | John Quincy Adams | one | 1825-1829 |
7 | Andrew Jackson | two | 1829-1837 |
8 | Martin Van Buren | one | 1837-1841 |
9 | William Henry Harrison | one-partial | 1841 |
10 | John Tyler | one-partial | 1841-1845 |
11 | James Knox Polk | one | 1845-1849 |
12 | Zachary Taylor | one-partial | 1849-1850 |
13 | Millard Fillmore | one-partial | 1850-1853 |
14 | Franklin Pierce | one | 1853-1857 |
15 | James Buchanan | one | 1857-1861 |
16 | Abraham Lincoln | two-partial | 1861-1865 |
17 | Andrew Johnson | one-partial | 1865-1869 |
18 | Ulysses S. Grant | two | 1869-1877 |
19 | Rutherford Birchard Hayes | one | 1877-1881 |
20 | James Abram Garfield | one-partial | 1881 |
21 | Chester Alan Arthur | one-partial | 1881-1885 |
22 | Grover Cleveland | one | 1885-1889 |
23 | Benjamin Harrison | one | 1889-1893 |
24 | Grover Cleveland | one-again | 1893-1897 |
25 | William McKinley | two-partial | 1897-1901 |
26 | Theodore Roosevelt | two-partial | 1901-1909 |
27 | William Howard Taft | one | 1909-1913 |
28 | Woodrow Wilson | two | 1913-1921 |
29 | Warren Gamaliel Harding | two-partial | 1921-1923 |
30 | Calvin Coolidge | two-partial | 1923-1929 |
31 | Herbert Clark Hoover | one | 1929-1933 |
32 | Franklin Delano Roosevelt | four-partial | 1933-1945 |
33 | Harry S. Truman | two-partial | 1945-1953 |
34 | Dwight David Eisenhower | two | 1953-1961 |
35 | John Fitzgerald Kennedy | two-partial | 1961-1963 |
36 | Lyndon Baines Johnson | two-partial | 1963-1969 |
37 | Richard Milhous Nixon | two-partial | 1969-1974 |
38 | Gerald Rudolph Ford | two-partial | 1974-1977 |
39 | James Earl Carter, Jr. | one | 1977-1981 |
40 | Ronald Wilson Reagan | two | 1981-1989 |
41 | George Herbert Walker Bush | one | 1989-1993 |
42 | William Jefferson Clinton | two | 1993-2001 |
43 | George Walker Bush | two | 2001-2009 |
44 | Barack Hussein Obama | one | 2009- |
Data as of October, 2012.
79 |$('table').filterTable({ 81 | inputSelector: '#input-filter' 82 | });83 | 84 | 85 | 92 | 93 | -------------------------------------------------------------------------------- /examples/filtertable-ignore-class.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 |
This is a sample of the jQuery.FilterTable plugin using the ignoreClass
option.
In this sample, cells with the no-filter
class are ignored—not filtered. Also in this sample, the ignored cells are styled via CSS to help identify that they are ignored.
For example:
23 |no-filter
class.no-filter
class.no-filter
class.Fruit | 32 |Mesocarp Color(s) When Ripe | 33 |
---|---|
Avocado | Green |
Banana | Yellow |
Dragon fruit | Pink, White |
Guava | Pink |
Lilikoʻi (Passion fruit) | Orange, Yellow |
Lychee | White |
Mango | Orange, Yellow |
Papaya | Orange, Red, Yellow |
Pineapple | White, Yellow |
Star fruit | Green, White, Yellow |
$('table').filterTable({ 50 | ignoreClass: 'no-filter' 51 | });52 | 53 | 54 | 60 | 61 | 62 | -------------------------------------------------------------------------------- /examples/filtertable-ignore-columns.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 |
This is a sample of the jQuery.FilterTable plugin using the ignoreColumns
option.
In this sample, columns the first and third columns (0 and 2) are ignored—not filtered. Also in this sample, the ignored columns are styled via CSS to help identify that they are ignored.
21 |For example:
22 |# | 32 |President | 33 |Terms | 34 |Tenure | 35 |
---|---|---|---|
1 | George Washington | two | 1789-1797 |
2 | John Adams | one | 1797-1801 |
3 | Thomas Jefferson | two | 1801-1809 |
4 | James Madison | two | 1809-1817 |
5 | James Monroe | two | 1817-1825 |
6 | John Quincy Adams | one | 1825-1829 |
7 | Andrew Jackson | two | 1829-1837 |
8 | Martin Van Buren | one | 1837-1841 |
9 | William Henry Harrison | one-partial | 1841 |
10 | John Tyler | one-partial | 1841-1845 |
11 | James Knox Polk | one | 1845-1849 |
12 | Zachary Taylor | one-partial | 1849-1850 |
13 | Millard Fillmore | one-partial | 1850-1853 |
14 | Franklin Pierce | one | 1853-1857 |
15 | James Buchanan | one | 1857-1861 |
16 | Abraham Lincoln | two-partial | 1861-1865 |
17 | Andrew Johnson | one-partial | 1865-1869 |
18 | Ulysses S. Grant | two | 1869-1877 |
19 | Rutherford Birchard Hayes | one | 1877-1881 |
20 | James Abram Garfield | one-partial | 1881 |
21 | Chester Alan Arthur | one-partial | 1881-1885 |
22 | Grover Cleveland | one | 1885-1889 |
23 | Benjamin Harrison | one | 1889-1893 |
24 | Grover Cleveland | one-again | 1893-1897 |
25 | William McKinley | two-partial | 1897-1901 |
26 | Theodore Roosevelt | two-partial | 1901-1909 |
27 | William Howard Taft | one | 1909-1913 |
28 | Woodrow Wilson | two | 1913-1921 |
29 | Warren Gamaliel Harding | two-partial | 1921-1923 |
30 | Calvin Coolidge | two-partial | 1923-1929 |
31 | Herbert Clark Hoover | one | 1929-1933 |
32 | Franklin Delano Roosevelt | four-partial | 1933-1945 |
33 | Harry S. Truman | two-partial | 1945-1953 |
34 | Dwight David Eisenhower | two | 1953-1961 |
35 | John Fitzgerald Kennedy | two-partial | 1961-1963 |
36 | Lyndon Baines Johnson | two-partial | 1963-1969 |
37 | Richard Milhous Nixon | two-partial | 1969-1974 |
38 | Gerald Rudolph Ford | two-partial | 1974-1977 |
39 | James Earl Carter, Jr. | one | 1977-1981 |
40 | Ronald Wilson Reagan | two | 1981-1989 |
41 | George Herbert Walker Bush | one | 1989-1993 |
42 | William Jefferson Clinton | two | 1993-2001 |
43 | George Walker Bush | two | 2001-2009 |
44 | Barack Hussein Obama | one | 2009- |
Data as of October, 2012.
85 |$('table').filterTable({ 87 | ignoreColumns: [0, 2] 88 | });89 | 90 | 91 | 97 | 98 | 99 | -------------------------------------------------------------------------------- /examples/filtertable-min-chars.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 |
This is a sample of the jQuery.FilterTable plugin illustrating the minChars
option. This sample sets the option to 3, meaning the term must be at least 3 characters to trigger the filtering.
Special note for usability: Your visitors may not know that there is a minumum number of characters needed for the filtering, so you will likely want to also indicate so with the label
or placeholder
options.
For example:
19 |# | 30 |President | 31 |Terms | 32 |Tenure | 33 |
---|---|---|---|
1 | George Washington | two | 1789-1797 |
2 | John Adams | one | 1797-1801 |
3 | Thomas Jefferson | two | 1801-1809 |
4 | James Madison | two | 1809-1817 |
5 | James Monroe | two | 1817-1825 |
6 | John Quincy Adams | one | 1825-1829 |
7 | Andrew Jackson | two | 1829-1837 |
8 | Martin Van Buren | one | 1837-1841 |
9 | William Henry Harrison | one-partial | 1841 |
10 | John Tyler | one-partial | 1841-1845 |
11 | James Knox Polk | one | 1845-1849 |
12 | Zachary Taylor | one-partial | 1849-1850 |
13 | Millard Fillmore | one-partial | 1850-1853 |
14 | Franklin Pierce | one | 1853-1857 |
15 | James Buchanan | one | 1857-1861 |
16 | Abraham Lincoln | two-partial | 1861-1865 |
17 | Andrew Johnson | one-partial | 1865-1869 |
18 | Ulysses S. Grant | two | 1869-1877 |
19 | Rutherford Birchard Hayes | one | 1877-1881 |
20 | James Abram Garfield | one-partial | 1881 |
21 | Chester Alan Arthur | one-partial | 1881-1885 |
22 | Grover Cleveland | one | 1885-1889 |
23 | Benjamin Harrison | one | 1889-1893 |
24 | Grover Cleveland | one-again | 1893-1897 |
25 | William McKinley | two-partial | 1897-1901 |
26 | Theodore Roosevelt | two-partial | 1901-1909 |
27 | William Howard Taft | one | 1909-1913 |
28 | Woodrow Wilson | two | 1913-1921 |
29 | Warren Gamaliel Harding | two-partial | 1921-1923 |
30 | Calvin Coolidge | two-partial | 1923-1929 |
31 | Herbert Clark Hoover | one | 1929-1933 |
32 | Franklin Delano Roosevelt | four-partial | 1933-1945 |
33 | Harry S. Truman | two-partial | 1945-1953 |
34 | Dwight David Eisenhower | two | 1953-1961 |
35 | John Fitzgerald Kennedy | two-partial | 1961-1963 |
36 | Lyndon Baines Johnson | two-partial | 1963-1969 |
37 | Richard Milhous Nixon | two-partial | 1969-1974 |
38 | Gerald Rudolph Ford | two-partial | 1974-1977 |
39 | James Earl Carter, Jr. | one | 1977-1981 |
40 | Ronald Wilson Reagan | two | 1981-1989 |
41 | George Herbert Walker Bush | one | 1989-1993 |
42 | William Jefferson Clinton | two | 1993-2001 |
43 | George Walker Bush | two | 2001-2009 |
44 | Barack Hussein Obama | one | 2009- |
Data as of October, 2012.
83 |$('table').filterTable({ 85 | minChars: 3, 86 | label: 'Filter (3+ characters):' 87 | });88 | 89 | 90 | 95 | 96 | 97 | -------------------------------------------------------------------------------- /examples/filtertable-min-rows.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 |
This is a sample of the jQuery.FilterTable plugin which illustrates the minRows
option.
By default, the plugin will add filtering only to tables with at least 8 rows in the tbody
. In this example, the table has more than the minimum rows, so filtering is added.
Fruit | 23 |Mesocarp Color(s) When Ripe | 24 |
---|---|
Avocado | Green |
Banana | Yellow |
Dragon fruit | Pink, White |
Guava | Pink |
Lilikoʻi (Passion fruit) | Orange, Yellow |
Lychee | White |
Mango | Orange, Yellow |
Papaya | Orange, Red, Yellow |
Pineapple | White, Yellow |
Star fruit | Green, White, Yellow |
$('.example-1').filterTable();41 | 42 |
By default, the plugin will add filtering only to tables with at least 8 rows in the tbody
. On a table with fewer than this minimum, no filtering is added.
Fruit | 48 |Mesocarp Color(s) When Ripe | 49 |
---|---|
Avocado | Green |
Banana | Yellow |
Mango | Orange, Yellow |
Papaya | Orange, Red, Yellow |
Pineapple | White, Yellow |
$('.example-2').filterTable();61 | 62 |
Setting the minRows
option to 0
will always add filtering to a table, no matter how many rows the tbody
contains.
Fruit | 68 |Mesocarp Color(s) When Ripe | 69 |
---|---|
Avocado | Green |
Banana | Yellow |
Mango | Orange, Yellow |
Papaya | Orange, Red, Yellow |
Pineapple | White, Yellow |
$('.example-3').filterTable({ 81 | minRows: 0 82 | });83 | 84 | 85 | 86 | 93 | 94 | -------------------------------------------------------------------------------- /examples/filtertable-quick.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 |
This is a sample of the jQuery.FilterTable plugin which shows the usage of the quickList
optional parameter.
Note that the “neighbor island” quick list item works because within some cells exists code that is hidden with CSS: <span class="hidden">neighbor island</span>
.
Campus | 33 |Island | 34 |Fall 2011 Enrollment |
35 |
---|---|---|
University of Hawaiʻi at Hilo | 40 |Hawaiʻi neighbor island | 41 |4,100 | 42 |
University of Hawaiʻi at Mānoa | 45 |Oʻahu | 46 |20,400 | 47 |
University of Hawaiʻi—West Oʻahu | 50 |Oʻahu | 51 |1,600 | 52 |
Hawaiʻi Community College | 55 |Hawaiʻi neighbor island | 56 |3,900 | 57 |
Honolulu Community College | 60 |Oʻahu | 61 |4,600 | 62 |
Kapiʻolani Community College | 65 |Oʻahu | 66 |9,000 | 67 |
Kauaʻi Community College | 70 |Kauaʻi neighbor island | 71 |1,400 | 72 |
Leeward Community College | 75 |Oʻahu | 76 |7,900 | 77 |
Maui College | 80 |Maui neighbor island | 81 |4,500 | 82 |
Windward Community College | 85 |Oʻahu | 86 |2,700 | 87 |
Note that while the filter is case-insensitive, it is UTF-8 aware so searching for oahu
will not find Oʻahu
.
$('table').filterTable({ 94 | quickList: quickList: [ 95 | 'Oʻahu', 96 | 'Hawaiʻi', 97 | 'university', 98 | 'college', 99 | 'neighbor island' 100 | ], 101 | quickListClear: '× clear filter' 102 | });103 | 104 | 105 | 106 | 114 | 115 | 116 | -------------------------------------------------------------------------------- /examples/filtertable-sample.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 |
This is a very plain sample of the jQuery.FilterTable plugin.
17 |# | 22 |President | 23 |Terms | 24 |Tenure | 25 |
---|---|---|---|
1 | George Washington | two | 1789-1797 |
2 | John Adams | one | 1797-1801 |
3 | Thomas Jefferson | two | 1801-1809 |
4 | James Madison | two | 1809-1817 |
5 | James Monroe | two | 1817-1825 |
6 | John Quincy Adams | one | 1825-1829 |
7 | Andrew Jackson | two | 1829-1837 |
8 | Martin Van Buren | one | 1837-1841 |
9 | William Henry Harrison | one-partial | 1841 |
10 | John Tyler | one-partial | 1841-1845 |
11 | James Knox Polk | one | 1845-1849 |
12 | Zachary Taylor | one-partial | 1849-1850 |
13 | Millard Fillmore | one-partial | 1850-1853 |
14 | Franklin Pierce | one | 1853-1857 |
15 | James Buchanan | one | 1857-1861 |
16 | Abraham Lincoln | two-partial | 1861-1865 |
17 | Andrew Johnson | one-partial | 1865-1869 |
18 | Ulysses S. Grant | two | 1869-1877 |
19 | Rutherford Birchard Hayes | one | 1877-1881 |
20 | James Abram Garfield | one-partial | 1881 |
21 | Chester Alan Arthur | one-partial | 1881-1885 |
22 | Grover Cleveland | one | 1885-1889 |
23 | Benjamin Harrison | one | 1889-1893 |
24 | Grover Cleveland | one-again | 1893-1897 |
25 | William McKinley | two-partial | 1897-1901 |
26 | Theodore Roosevelt | two-partial | 1901-1909 |
27 | William Howard Taft | one | 1909-1913 |
28 | Woodrow Wilson | two | 1913-1921 |
29 | Warren Gamaliel Harding | two-partial | 1921-1923 |
30 | Calvin Coolidge | two-partial | 1923-1929 |
31 | Herbert Clark Hoover | one | 1929-1933 |
32 | Franklin Delano Roosevelt | four-partial | 1933-1945 |
33 | Harry S. Truman | two-partial | 1945-1953 |
34 | Dwight David Eisenhower | two | 1953-1961 |
35 | John Fitzgerald Kennedy | two-partial | 1961-1963 |
36 | Lyndon Baines Johnson | two-partial | 1963-1969 |
37 | Richard Milhous Nixon | two-partial | 1969-1974 |
38 | Gerald Rudolph Ford | two-partial | 1974-1977 |
39 | James Earl Carter, Jr. | one | 1977-1981 |
40 | Ronald Wilson Reagan | two | 1981-1989 |
41 | George Herbert Walker Bush | one | 1989-1993 |
42 | William Jefferson Clinton | two | 1993-2001 |
43 | George Walker Bush | two | 2001-2009 |
44 | Barack Hussein Obama | one | 2009- |
Data as of October, 2012.
75 |$('table').filterTable();77 | 78 | 79 | 84 | 85 | -------------------------------------------------------------------------------- /examples/filtertable-striping.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 |
This is a plain row striping sample of the jQuery.FilterTable plugin. It shows the code to stripe alternate rows.
22 |# | 27 |President | 28 |Terms | 29 |Tenure | 30 |
---|---|---|---|
1 | George Washington | two | 1789-1797 |
2 | John Adams | one | 1797-1801 |
3 | Thomas Jefferson | two | 1801-1809 |
4 | James Madison | two | 1809-1817 |
5 | James Monroe | two | 1817-1825 |
6 | John Quincy Adams | one | 1825-1829 |
7 | Andrew Jackson | two | 1829-1837 |
8 | Martin Van Buren | one | 1837-1841 |
9 | William Henry Harrison | one-partial | 1841 |
10 | John Tyler | one-partial | 1841-1845 |
11 | James Knox Polk | one | 1845-1849 |
12 | Zachary Taylor | one-partial | 1849-1850 |
13 | Millard Fillmore | one-partial | 1850-1853 |
14 | Franklin Pierce | one | 1853-1857 |
15 | James Buchanan | one | 1857-1861 |
16 | Abraham Lincoln | two-partial | 1861-1865 |
17 | Andrew Johnson | one-partial | 1865-1869 |
18 | Ulysses S. Grant | two | 1869-1877 |
19 | Rutherford Birchard Hayes | one | 1877-1881 |
20 | James Abram Garfield | one-partial | 1881 |
21 | Chester Alan Arthur | one-partial | 1881-1885 |
22 | Grover Cleveland | one | 1885-1889 |
23 | Benjamin Harrison | one | 1889-1893 |
24 | Grover Cleveland | one-again | 1893-1897 |
25 | William McKinley | two-partial | 1897-1901 |
26 | Theodore Roosevelt | two-partial | 1901-1909 |
27 | William Howard Taft | one | 1909-1913 |
28 | Woodrow Wilson | two | 1913-1921 |
29 | Warren Gamaliel Harding | two-partial | 1921-1923 |
30 | Calvin Coolidge | two-partial | 1923-1929 |
31 | Herbert Clark Hoover | one | 1929-1933 |
32 | Franklin Delano Roosevelt | four-partial | 1933-1945 |
33 | Harry S. Truman | two-partial | 1945-1953 |
34 | Dwight David Eisenhower | two | 1953-1961 |
35 | John Fitzgerald Kennedy | two-partial | 1961-1963 |
36 | Lyndon Baines Johnson | two-partial | 1963-1969 |
37 | Richard Milhous Nixon | two-partial | 1969-1974 |
38 | Gerald Rudolph Ford | two-partial | 1974-1977 |
39 | James Earl Carter, Jr. | one | 1977-1981 |
40 | Ronald Wilson Reagan | two | 1981-1989 |
41 | George Herbert Walker Bush | one | 1989-1993 |
42 | William Jefferson Clinton | two | 1993-2001 |
43 | George Walker Bush | two | 2001-2009 |
44 | Barack Hussein Obama | one | 2009- |
Data as of October, 2012.
80 |var stripeTable = function(table) { //stripe the table (jQuery selector) 82 | table.find('tr').removeClass('striped').filter(':visible:even').addClass('striped'); 83 | }; 84 | $('table').filterTable({ 85 | callback: function(term, table) { stripeTable(table); } //call the striping after every change to the filter term 86 | }); 87 | stripeTable($('table')); //stripe the table for the first time88 | 89 | 90 | 101 | 102 | -------------------------------------------------------------------------------- /examples/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 |
The following are very basic pages which use the jQuery Filter Table Plugin.
12 |