1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975
|
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>jQuery tablesorter 2.0 - Filter Widget</title>
<!-- jQuery -->
<script src="js/jquery-latest.min.js"></script>
<!-- Demo stuff -->
<link class="ui-theme" rel="stylesheet" href="css/jquery-ui.min.css">
<script src="js/jquery-ui.min.js"></script>
<link rel="stylesheet" href="css/jq.css">
<link href="css/prettify.css" rel="stylesheet">
<script src="js/prettify.js"></script>
<script src="js/docs.js"></script>
<style>
/* override the vertical-align top in the blue theme */
.notes.tablesorter-blue tbody td { vertical-align: middle; }
</style>
<!-- Tablesorter: required -->
<link rel="stylesheet" href="../css/theme.blue.css">
<script src="../js/jquery.tablesorter.js"></script>
<script src="../js/widgets/widget-storage.js"></script>
<script src="../js/widgets/widget-filter.js"></script>
<script id="js">$(function() {
// call the tablesorter plugin
$("#table").tablesorter({
theme: 'blue',
// hidden filter input/selects will resize the columns, so try to minimize the change
widthFixed : true,
// initialize zebra striping and filter widgets
widgets: ["zebra", "filter"],
ignoreCase: false,
widgetOptions : {
// filter_anyMatch options was removed in v2.15; it has been replaced by the filter_external option
// If there are child rows in the table (rows with class name from "cssChildRow" option)
// and this option is true and a match is found anywhere in the child row, then it will make that row
// visible; default is false
filter_childRows : false,
// if true, filter child row content by column; filter_childRows must also be true
filter_childByColumn : false,
// if true, include matching child row siblings
filter_childWithSibs : true,
// if true, a filter will be added to the top of each table column;
// disabled by using -> headers: { 1: { filter: false } } OR add class="filter-false"
// if you set this to false, make sure you perform a search using the second method below
filter_columnFilters : true,
// if true, allows using "#:{query}" in AnyMatch searches (column:query; added v2.20.0)
filter_columnAnyMatch: true,
// extra css class name (string or array) added to the filter element (input or select)
filter_cellFilter : '',
// extra css class name(s) applied to the table row containing the filters & the inputs within that row
// this option can either be a string (class applied to all filters) or an array (class applied to indexed filter)
filter_cssFilter : '', // or []
// add a default column filter type "~{query}" to make fuzzy searches default;
// "{q1} AND {q2}" to make all searches use a logical AND.
filter_defaultFilter : {},
// filters to exclude, per column
filter_excludeFilter : {},
// jQuery selector (or object) pointing to an input to be used to match the contents of any column
// please refer to the filter-any-match demo for limitations - new in v2.15
filter_external : '',
// class added to filtered rows (rows that are not showing); needed by pager plugin
filter_filteredRow : 'filtered',
// ARIA-label added to filter input/select; {{label}} is replaced by the column header
// "data-label" attribute, if it exists, or it uses the column header text
filter_filterLabel : 'Filter "{{label}}" column by...',
// 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,
// hide filter row when table is empty
filter_hideEmpty : true,
// if true, filters are collapsed initially, but can be revealed by hovering over the grey bar immediately
// below the header row. Additionally, tabbing through the document will open the filter row when an input gets focus
// in v2.26.6, this option will also accept a function
filter_hideFilters : true,
// 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).
// In v2.27.3, this option can contain an
// object with column indexes or classnames; "fallback" is used
// for undefined columns
filter_liveSearch : true,
// global query settings ('exact' or 'match'); overridden by "filter-match" or "filter-exact" class
filter_matchType : { 'input': 'exact', 'select': 'exact' },
// a header with a select dropdown & this class name will only show available (visible) options within that drop down.
filter_onlyAvail : 'filter-onlyAvail',
// default placeholder text (overridden by any header "data-placeholder" setting)
filter_placeholder : { search : '', select : '' },
// jQuery selector string of an element used to reset the filters
filter_reset : 'button.reset',
// Reset filter input when the user presses escape - normalized across browsers
filter_resetOnEsc : true,
// Use the $.tablesorter.storage utility to save the most recent filters (default setting is false)
filter_saveFilters : true,
// Delay in milliseconds before the filter widget starts searching; This option prevents searching for
// every character while typing and should make searching large tables faster.
filter_searchDelay : 300,
// allow searching through already filtered rows in special circumstances; will speed up searching in large tables if true
filter_searchFiltered: true,
// include a function to return an array of values to be added to the column filter select
filter_selectSource : null,
// 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,
// Filter using parsed content for ALL columns
// be careful on using this on date columns as the date is parsed and stored as time in seconds
filter_useParsedData : false,
// data attribute in the header cell that contains the default filter value
filter_defaultAttrib : 'data-value',
// filter_selectSource array text left of the separator is added to the option value, right into the option text
filter_selectSourceSeparator : '|'
}
});
// Clear stored filters - added v2.25.6
$('.resetsaved').click(function() {
$('#table').trigger('filterResetSaved');
// show quick popup to indicate something happened
var $message = $('<span class="results"> Reset</span>').insertAfter(this);
setTimeout(function() {
$message.remove();
}, 500);
return false;
});
// External search
// buttons set up like this:
// <button type="button" data-filter-column="4" data-filter-text="2?%">Saved Search</button>
$('button[data-filter-column]').click(function() {
/*** first method *** data-filter-column="1" data-filter-text="!son"
add search value to Discount column (zero based index) input */
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 targeting a sticky header
$.tablesorter.setFilters( $('#table'), filters, true ); // new v2.9
/** old method (prior to tablsorter v2.9 ***
var filters = $('table.tablesorter').find('input.tablesorter-filter');
filters.val(''); // clear all filters
filters.eq(col).val(txt).trigger('search', false);
******/
/*** second method ***
this method bypasses the filter inputs, so the "filter_columnFilters"
option can be set to false (no column filters showing)
******/
/*
var columns = [];
columns[5] = '2?%'; // or define the array this way [ '', '', '', '', '', '2?%' ]
$('table').trigger('search', [ columns ]);
*/
return false;
});
});</script>
<script>
$(function() {
// *** widgetfilter_startsWith toggle button ***
$('button.toggle').click(function() {
var c = $('#table')[0].config,
$t = $(this),
// toggle the boolean
fsw = !c.widgetOptions.filter_startsWith,
fic = !c.widgetOptions.filter_ignoreCase;
if ($t.hasClass('fsw')) {
c.widgetOptions.filter_startsWith = fsw;
$('#start').html(fsw.toString());
} else if ($t.hasClass('fic')) {
c.widgetOptions.filter_ignoreCase = fic;
$('#case').html(fic.toString());
} else {
$t = c.$headers.eq(1).toggleClass('filter-match');
$t.find('span').html( $t.hasClass('filter-match') ? '' : ' No' );
}
// update search after option change; add false to trigger to skip search delay
c.$table.trigger('search', false);
return false;
});
});
</script>
</head>
<body>
<div id="banner">
<h1>table<em>sorter</em></h1>
<h2>Filter Widget</h2>
<h3>Flexible client-side table sorting</h3>
<a href="index.html">Back to documentation</a>
</div>
<div id="main">
<p></p>
<br>
<div id="root" class="accordion">
<h3 id="notes"><a href="#">Notes</a></h3>
<div>
<ul>
<li>In <span class="version">v2.29.4</span>, <code>filter_filterLabel</code> option was added to include an ARIA-label to the filter inputs and selects.</li>
<li>In <span class="verison">v2.27.3</span>, <code>filter_liveSearch</code> will now accept an object containing zero-based column indexes or header class names.</li>
<li>In <span class="verison">v2.26.6</span>, the <a class="intlink" href="#filter-hidefilters"><code>hideFilters</code></a> setting will now accept a function to determine when to hide the filter row.</li>
<li>In <span class="version">v2.25.6</span>, added <a class="intlink" href="#methods"><code>filterResetSaved</code></a> method to clear stored filter values.</li>
<li>In <span class="version">v2.25.2</span>, added <a class="intlink" href="#filter-resetonesc"><code>filter_resetOnEsc</code></a> option.</li>
<li>In <span class="version">v2.22.2</span>,
<ul>
<li>The <a class="intlink" href="#method-get-filters"><code>getFilters</code></a> function will now target the last used filter properly.</li>
<li>The <a class="intlink" href="#filter-select-source"><code>filter_selectSource</code></a> option now ignores parsers if none are set.</li>
<li>Added the ability to nest filter types with a logical "OR" or a logical "AND". Try these filters: <button type="button" data-filter-column="1">a && !o</button> (<span class="label warning">*NOTE*</span> try this with and without the filter-match class applied), <button type="button" data-filter-column="3"><20 or >40</button> or <button type="button" data-filter-column="3">>20 && <40</button></li>
</ul>
</li>
</ul>
<div class="accordion start-closed">
<h3 id="old-notes"><a href="#">Older Notes</a></h3>
<div>
<ul>
<li>In <span class="version">v2.22.0</span>
<ul>
<li>Regex filter searches now cache the created regex object for each query to optimize speed & a regex search now properly uses case-sensitive content.</li>
<li>Add <code>data</code> parameter to <a class="intlink" href="#filter-functions"><code>filter_functions</code></a> (<a href="example-widget-filter-custom-search.html#how_to_add_custom_filter_types">get more details</a>).</li>
<li>Any match searches which target specific columns will no longer save each filter to its respective column; see <a href="example-widget-filter-any-match.html#anymatch_searches">"AnyMatch Searches"</a> documentation.</li>
<li>Operator filter searchs now ignore empty strings (because <code>"" < 10</code> is <code>true</code>).</li>
<li>Added <a class="intlink" href="#filter-child-by-column"><code>filter_childByColumn</code></a> option which allows the filtering columns in both the parent & child rows. Demo added to the <a href="example-child-rows-filtered.html#child-by-column">filtered child rows demo</a></li>
</ul>
</li>
<li>In <span class="version updated">v2.18.0</span>, added <code>filter_cellFilter</code> & the ability to set multiple "any" match columns for an external search (see the <a href="example-widget-filter-external-inputs.html">external inputs demo</a> for more details).</li>
<li>In <span class="version">v2.17.8</span>, filter selects will default to exact matches unless the header cell has a <a class="intlink" href="#classes"><code>"filter-match"</code></a> class added.</li>
<li>In <span class="version">v2.17.1</span>, added a not exact match (<code>!=</code>) filter type.</li>
<li>In <span class="version updated">v2.16+</span>,
<ul>
<li>When a default filter select is added to a column, it is now parsed from the assigned parser, then sorted using the <a href="index.html#textsorter"><code>textSorter</code></a> setting, and falls back to an alphanumeric sort (<span class="version updated">v2.16.3</span>).</li>
<li>Adding a class of <a class="intlink" href="#classes"><code>"filter-select-nosort"</code></a> will now leave the select options unsorted (<span class="version">v2.16.3</span>).</li>
<li>Added <a class="intlink" href="#filter-placeholder"><code>filter_placeholder</code></a> option (<span class="version">v2.16.0</span>).</li>
<li>Added <a class="intlink" href="#filter-select-source"><code>filter_selectSource</code></a> option (<span class="version">v2.16.3</span>).</li>
<li>updated <a class="intlink" href="#filter-reset"><code>filter_reset</code></a> option (<span class="version updated">v2.16.3</span>).</li>
</ul>
</li>
<li>In <span class="version updated">v2.15</span>,
<ul>
<li>The <a class="intlink" href="#filter-any-match"><code>filter_anyMatch</code></a> widget option was completely <span class="label alert">removed</span>. Sorry for not deprecating this option, but the filter any match code was completely rewritten.</li>
<li>Added a <a class="intlink" href="#filter-external"><code>filter_external</code></a> widget option to only accept a jQuery selector string/object; please see the updated <a href="example-widget-filter-any-match.html">filter any match</a> demo for more details.</li>
</ul>
</li>
<li>Added & set <a class="intlink" href="#filter-save-filters"><code>filter_saveFilters</code></a> to <code>true</code> (default is <code>false</code>) in this demo (<span class="version">v2.14</span>).</li>
</ul>
</div>
</div>
<ul>
<li><span class="label alert">*NOTE*</span> The filter widget is set to use extracted (parsed) content as parsed values and the raw cell content as unparsed values; and most of the time the filter is searching unparsed content (see <a class="intlink" href="#classes"><code>filter-parsed</code></a> class and <a class="intlink" href="#filter-use-parsed-data"><code>filter_useParsedData</code></a> option. But, when a data-attribute is used (see <a href="index.html#textattribute"><code>textAttribute</code></a> option), both the parsed and raw cached data will contain the <em>exact same content</em> (<a href="https://github.com/Mottie/tablesorter/issues/983">ref</a>)!</li>
<li><span class="label alert">*NOTE*</span> If using a custom theme, make sure to add the class set in the <a class="intlink" href="#filter-filtered-row"><code>filter_filteredRow</code></a> option (set to <code>filtered</code> by default) in the css, and set it to <code>display:none</code>. When filtering rows, the filter widget adds the <a class="intlink" href="#filter-filtered-row"><code>"filtered"</code></a> class to hide the row; all available themes include this definition.</li>
<li>Hover over the grey bar below the table header to open the filter row. Disable this by setting <a class="intlink" href="#filter-hide-filters"><code>filter_hideFilters</code></a> option to <code>false</code>.</li>
<li>This widget uses jQuery's <code>.nextUntil()</code> function which is only available is jQuery version 1.4+.</li>
<li>This widget <em>does NOT</em> work with tablesorter v2.0.5.</li>
<li>Using the built-in filters (<a href="example-widget-filter-custom-search.html">learn how to customize them here</a> - demo created <span class="version">v2.17.5</span>):
<table class="tablesorter-blue notes">
<thead>
<tr>
<th style="width:1%">Priority</th>
<th style="width:9%">Type <small class="bright">(1)</small></th>
<th style="width:30%">Description</th>
<th style="width:60%">Examples</th>
</tr>
</thead>
<tbody>
<tr><td class="center">1</td><td class="center"><code>|</code> or <code> OR </code></td><td>Logical "or" (Vertical bar). Filter the column for content that matches text from either side of the bar <small class="bright">(2)</small>.</td><td><code>box|bat</code> (matches a column cell with either "box" or "bat");<button type="button" data-filter-column="1">Alex|Peter</button> (Find text that contains either "Alex" or "Peter"); <button type="button" data-filter-column="3"><20 or >40</button></td></tr>
<tr><td class="center">2</td><td class="center"><code> && </code> or <code> AND </code></td><td>Logical "and". Filter the column for content that matches text from either side of the operator.</td><td><code>box && bat</code> (matches a column cell that contains both "box" and "bat"), <button type="button" data-filter-column="1">Br && c</button> (Find text that contains both "br" and "c"), <button type="button" data-filter-column="3">>20 && <40</button> or <button type="button" data-filter-column="1">a and !o</button> (When "filter-match" is set, find content with the letter "a", but not the letter "o")</td></tr>
<tr><td class="center">3</td><td class="center"><code>/\d/</code></td><td>Add any regex to the query to use in the query ("mig" flags can be included <code>/\w/mig</code>)</td><td><code>/b[aeiou]g/i</code> (finds "bag", "beg", "BIG", "Bug", etc);<button type="button" data-filter-column="1">/r$/</button> (matches text that ends with an "r")</td></tr>
<tr><td class="center">4</td><td class="center"><code>< <= >= ></code></td><td>Find alphabetical or numerical values less than or greater than or equal to the filtered query <small class="bright">(1)</small>.</td><td><button type="button" data-filter-column="5">>= 10</button> (find values greater than or equal to 10)</td></tr>
<tr><td class="center">5</td><td class="center"><code>!</code> or <code>!=</code></td><td>Not operator, or not exactly match. Filter the column with content that <strong>do not</strong> match the query. Include an equal (<code>=</code>), single (<code>'</code>) or double quote (<code>"</code>) to exactly <em>not</em> match a filter (<span class="version">v2.17.1</span>).</td><td><code>!fe</code> (hide rows with "female" in that column, but shows rows with "male");<button type="button" data-filter-column="1">!a</button> (find text that doesn't contain an "a");<button type="button" data-filter-column="1">!"Bruce"</button> (find content that does not exactly match "Bruce")</td></tr>
<tr><td class="center">6</td><td class="center"><code>"</code> or <code>=</code></td><td>To exactly match the search query, add a quote, apostrophe or equal sign to the beginning and/or end of the query</td><td><code>abc"</code> or <code>abc=</code> (exactly match "abc");<button type="button" data-filter-column="1">John"</button> or <button type="button" data-filter-column="1">John=</button> (exactly match "John")</td></tr>
<tr><td class="center">7</td><td class="center"><code> - </code> or <code> to </code></td><td>Find a range of values. Make sure there is a space before and after the dash (or the word "to") <small class="bright">(3)</small>.</td><td><button type="button" data-filter-column="3">10 - 30</button> or <button type="button" data-filter-column="4">10 to 30</button> (match values between 10 and 30)</td></tr>
<tr><td class="center">8</td><td class="center"><code>?</code></td><td>Wildcard for a single, non-space character.</td><td><code>J?n</code> (finds "Jan" and "Jun", but not "Joan");<button type="button" data-filter-column="2">a?s</button> (finds "Dumass" and "Evans", but not "McMasters")</td></tr>
<tr><td class="center">8</td><td class="center"><code>*</code></td><td>Wildcard for zero or more non-space characters.</td><td><code>B*k</code> (matches "Black" and "Book");<button type="button" data-filter-column="2">a*s</button> (matches "Dumass", "Evans" and "McMasters")</td></tr>
<tr><td class="center">9</td><td class="center"><code>~</code></td><td>Perform a fuzzy search (matches sequential characters) by adding a tilde to the beginning of the query (<span class="version">v2.13.3</span>)</td><td><button type="button" data-filter-column="1">~bee</button> (matches "Bruce Lee" and "Brenda Dexter"), or <button type="button" data-filter-column="1">~piano</button> (matches "Philip Aaron Wong")</td></tr>
<tr><td class="center">10</td><td class="center">text</td><td>Any text entered in the filter will <strong>match</strong> text found within the column</td><td><code>abc</code> (finds "abc", "abcd", "abcde", etc);<button type="button" data-filter-column="1">Aaron</button> (finds "Aaron" and "Philip Aaron Wong")</td></tr>
</tbody>
</table>
<span class="bright">(1)</span> The filter order (or precendence) of how searches are checked in "priority" (first column) order; so an exact match will override "range" searches (*NOTE* order changed in <span class="version updated">v2.15</span>, operators prioritized before exact; see <a href="https://github.com/Mottie/tablesorter/issues/465">issue #465</a>; order changed again in <span class="version updated">v2.17.1</span> to move "not match" before "exact" and allow for exact not matches; see <a href="https://github.com/Mottie/tablesorter/issues/628">issue #628</a>). In <span class="version updated">v2.22.2</span>, the "or" and "and" types can combine any of the other filter types together.<br>
<span class="bright">(2)</span> Logical "or" comparisons can now show exact matches (by default; <span class="version">v2.10.1</span>) or just match cell contents.<br>
<span class="bright">(3)</span> In tablesorter <span class="version">v2.10</span>, comparisons can be made in date columns (if properly parsed).
</li>
</ul>
</div>
<h3><a href="#">Options</a></h3>
<div>
<h4>Filter widget defaults (added inside of tablesorter <code>widgetOptions</code>)</h4>
<h4><span class="label warning">NOTE</span> This table includes very basic information about the filter options. For more extensive information & links to demos, see the main page <a href="index.html#Widget-options">Widget & Pager Options</a> section.</h4>
<div>
<span class="label label-info">TIP!</span> Click on the link in the function column to reveal full details (or <a href="#" class="toggleAll">toggle</a>|<a href="#" class="showAll">show</a>|<a href="#" class="hideAll">hide</a> all) or double click to update the browser location.
</div>
<table class="options tablesorter-blue" data-sortlist="[[0,0]]">
<thead>
<tr><th>Option</th><th>Default</th><th class="sorter-false">Description</th></tr>
</thead>
<tbody>
<tr id="filter-child-rows">
<td><span class="permalink">filter_childRows</span></td>
<td>false</td>
<td>if <code>true</code>, filter includes child row content in the search.</td>
</tr>
<tr id="filter-child-by-column">
<td><a href="#" class="permalink">filter_childByColumn</a></td>
<td>false</td>
<td>if <code>true</code>, queries will search child row content by column (<span class="version">v2.22.0</span>).
<div class="collapsible">
<br>
The <code>filter_childRows</code> option must be <code>true</code> for this option to work.<br>
<br>
If <code>false</code>, and the <code>filter_childRows</code> option is <code>true</code>, then queries in <em>any column</em> will search all child content, as before this option was added.
</div>
</td>
</tr>
<tr id="filter-child-with-sibs">
<td><a href="#" class="permalink">filter_childWithSibs</a></td>
<td>true</td>
<td>if <code>true</code>, all sibling rows of the matching child row will also be visible (<span class="version">v2.23.4</span>).
<div class="collapsible">
<p>Both <code>filter_childRows</code> & <code>filter_childByColumn</code> options must be set to <code>true</code> for this option to work.</p>
If <code>false</code>, this option will only show the child row that matches the filter; and its parent row.
</div>
</td>
</tr>
<tr id="filter-column-filters">
<td><span class="permalink">filter_columnFilters</span></td>
<td>true</td>
<td>if <code>true</code>, a filter will be added to the top of each table column.</td>
</tr>
<tr id="filter-column-anymatch">
<td><a href="#" class="permalink">filter_columnAnyMatch</a></td>
<td>true</td>
<td>if <code>true</code>, allows using "#:{query}" in anyMatch searches (<span class="version">v2.20.0</span>).
<div class="collapsible">
<br>
Users can use the anymatch input to target a specific column, using a one-based index.
<p></p>
For example: In the table below, searching for <code>2:aa</code> in an anymatch filter will result in "Phillip Aaron Wong" and "Aaron" showing in the First Name column.
<p></p>
See live examples in the <a href="example-widget-filter-any-match.html#anymatch_searches">Filter Widget External Search</a> demo.
</div>
</td>
</tr>
<tr id="filter-cell-filter">
<td><a href="#" class="permalink">filter_cellFilter</a></td>
<td>''</td>
<td>Extra css class name (string or array) added to the filter element (input or select) (<span class="version">v2.18.0</span>)
<div class="collapsible">
<br>
The filter cell (<code><td></code>) is not to be confused with the <code>filter_cssFilter</code> option which adds an extra class name to the filter inputs (<code><input></code>).
</div>
</td>
</tr>
<tr id="filter-css-filter">
<td><a href="#" class="permalink">filter_cssFilter</a></td>
<td>''</td>
<td>
Extra css class name(s) applied to the table row containing the filters & the inputs within that row (<span class="version updated">v2.15</span>).
<div class="collapsible">
<br>
This option can either be a string (class applied to all filters) or an array (class applied to indexed filter).
</div>
</td>
</tr>
<tr id="filter-default-attrib">
<td><span class="permalink">filter_defaultAttrib</span></td>
<td>'data-value'</td>
<td>this option contains the name of the data-attribute which contains the default (starting) filter value.</td>
</tr>
<tr id="filter-defaultfilter">
<td><span class="permalink">filter_defaultFilter</span></td>
<td>{ }</td>
<td>Set a default filter for a set column (<span class="version">v2.17.8</span>).</td>
</tr>
<tr id="filter-excludefilter">
<td><span class="permalink">filter_excludeFilter</span></td>
<td>{ }</td>
<td>Set a column to exclude the chosen filter types (range, exact, notMatch, etc) (<span class="version">v2.17.8</span>).</td>
</tr>
<tr id="filter-external">
<td><a href="#" class="permalink">filter_external</a></td>
<td>''</td>
<td>
Set to a jQuery selector (or object) pointing to an input to be used to match the contents of any column (<span class="version">v2.15</span>).
<div class="collapsible">
<br>
Please refer to the updated <a href="example-widget-filter-any-match.html">filter-any-match demo</a> for the limitations of this setting.
</div>
</td>
</tr>
<tr id="filter-filtered-row">
<td><a href="#" class="permalink">filter_filteredRow</a></td>
<td>'filtered'</td>
<td>
CSS class name added to filtered rows (rows that are not showing); needed by pager plugin.
<div class="collapsible">
<br>
If modifying this definition, make sure that the new class is set to <code>display: none;</code> to hide the filtered rows.
</div>
</td>
</tr>
<tr id="filter-filter-label">
<td><a href="#" class="permalink">filter_filterLabel</a></td>
<td>'Filter "{{label}}" column by...'</td>
<td>
This option contains the ARIA-label value to be added to the filter input or select (<span class="version">v2.29.4</span>).
<div class="collapsible">
<p>
By default, a <code>{{label}}</code> is included in the setting to insert a column label. The content is obtained from the header cell's <code>data-label</code> attribute (do not include the <code>data-</code> prefix), if it exists, or the column header text. See the "First Name" column below for an example.
</p>
<span class="label label-info">Note</span> See the <a href="index.html#widget-filter-filterlabel">main page documentation for more important details</a>!
</div>
</td>
</tr>
<tr id="filter-formatter">
<td><a href="#" class="permalink">filter_formatter</a></td>
<td>null</td>
<td>
Add custom filter element(s) to the filter row
<div class="collapsible">
<br>
Custom filter elements include:
<ul>
<li><a href="example-widget-filter-formatter-1.html">jQuery UI widgets</a>: slider, spinner & datepicker</li>
<li><a href="example-widget-filter-formatter-2.html">HTML5 elements</a>: range, number input, color selector.</li>
<li><a href="example-widget-filter-formatter-select2.html">Select2 plugin</a>.</li>
</ul>
</div>
</td>
</tr>
<tr id="filter-functions">
<td><a href="#" class="permalink">filter_functions</a></td>
<td>null</td>
<td>
Add custom filter functions using this option.
<div class="collapsible">
<br>
See the <a href="example-widget-filter-custom.html">custom filter widget functions demo</a> for more details and numerous examples.
</div>
</td>
</tr>
<tr id="filter-hide-empty">
<td><span class="permalink">filter_hideEmpty</span></td>
<td>true</td>
<td>Hide filter row when the table is empty (<span class="version">v2.15</span>).</td>
</tr>
<tr id="filter-hide-filters">
<td><span class="permalink">filter_hideFilters</span></td>
<td>false</td>
<td>If <code>true</code>, filters are hidden initially, but can be revealed by hovering over the filter row, or giving a filter input focus (tabbing down the page).<br>
In <span class="version updated">v2.26.6</span>, a function can now be used to return a boolean value to set the visibility of the filter row. See the <a href="./#widget-filter-hidefilters">main documentation</a> for an example.
</td>
</tr>
<tr id="filter-ignore-case">
<td><span class="permalink">filter_ignoreCase</span></td>
<td>true</td>
<td>If <code>true</code>, all searches are case-insensitive.</td>
</tr>
<tr id="filter-live-search">
<td><a href="#" class="permalink">filter_liveSearch</a></td>
<td>true</td>
<td>
If <code>true</code>, search column content while the user types (with a short delay).
<div class="collapsible">
<br>
<ul>
<li>If <code>false</code>, the user must press enter to start the search.</li>
<li>If set to a number, when the length of the input text reaches this minimum length, a search will initiate.</li>
<li>In <span class="version">v2.27.3</span>, this option can be set as an object containing column zero-based indexes or header class names. If a column isn't defined in the object, the "fallback" key is checked and if undefined, the value defaults to <code>false</code>.</li>
</ul>
</div>
</td>
</tr>
<tr id="filter-matchtype">
<td><a href="#" class="permalink">filter_matchType</a></td>
<td>{ 'input': 'exact', 'select': 'exact' }</td>
<td>
This option sets the global setting that applied to either input or select filters (<span class="version">v2.25.5</span>)
<div class="collapsible">
<br>
There are only two options: "exact" and "match"; and it defaults to "exact" if anything else is entered.
</div>
</td>
</tr>
<tr id="filter-only-avail">
<td><span class="permalink">filter_onlyAvail</span></td>
<td>'filter-onlyAvail'</td>
<td>A header with a select dropdown & this class name set, will only show available (visible) options within that drop down.</td>
</tr>
<tr id="filter-placeholder">
<td><span class="permalink">filter_placeholder</span></td>
<td>{ search : '', select : '' }</td>
<td>Default placeholder text (overridden by any header "data-placeholder" setting; <span class="version">v2.16</span>).</td>
</tr>
<tr id="filter-reset">
<td><span class="permalink">filter_reset</span></td>
<td>null</td>
<td>jQuery selector string of an element used to reset the filters (v2.4; <span class="version updated">v2.16.0</span>).</td>
</tr>
<tr id="filter-resetonesc">
<td><span class="permalink">filter_resetOnEsc</span></td>
<td>true</td>
<td>Press escape to clear filter input - normalized across browsers (<span class="version">v2.25.2</span>).</td>
</tr>
<tr id="filter-save-filters">
<td><span class="permalink">filter_saveFilters</span></td>
<td>false</td>
<td>Uses the <code>$.tablesorter.storage</code> utility to save the most recent filters.</td>
</tr>
<tr id="filter-search-delay">
<td><span class="permalink">filter_searchDelay</span></td>
<td>300</td>
<td>Typing delay in milliseconds before starting a search.</td>
</tr>
<tr id="filter-search-filtered">
<td><span class="permalink">filter_searchFiltered</span></td>
<td>true</td>
<td>Allow searching through already filtered rows in special circumstances; will speed up searching in large tables if <code>true</code>.</td>
</tr>
<tr id="filter-select-source">
<td><span class="permalink">filter_selectSource</span></td>
<td>null</td>
<td>Include a function to return an array of values to be added to the column filter select (<span class="version">v2.16.0</span>).</td>
</tr>
<tr id="filter-select-source-separator">
<td><span class="permalink">filter_selectSourceSeparator</span></td>
<td>null</td>
<td><code>filter_selectSource</code> array text left of the separator is added to the option value, right into the option text.</td>
</tr>
<tr id="filter-serverside-filtering">
<td><span class="permalink">filter_serversideFiltering</span></td>
<td>false</td>
<td>If <code>true</code>, filter will be done server-side. The client-side filtering will be disabled, but the ui and events will still be used.</td>
</tr>
<tr id="filter-starts-with">
<td><span class="permalink">filter_startsWith</span></td>
<td>false</td>
<td>If <code>true</code>, filter start from the beginning of the cell contents.</td>
</tr>
<tr id="filter-use-parsed-data">
<td><span class="permalink">filter_useParsedData</span></td>
<td>false</td>
<td>Filter all data using parsed content.</td>
</tr>
</tbody>
<tbody>
<tr><th colspan="3">Removed options</th></tr>
</tbody>
<tbody>
<tr id="filter-any-match">
<td><span class="permalink alert">filter_anyMatch</span></td>
<td>null</td>
<td>jQuery selector string (or jQuery object) of external anyMatch filter (<span class="label alert">removed</span> in v2.15; please see <a href="example-widget-filter-any-match.html">the demo</a> for more details)</td>
</tr>
</tbody>
</table>
</div>
<h3><a href="#">Classes</a></h3>
<div>
Class names that can be added to the <code>th</code> header cells:
<ul>
<li><code>filter-exact</code> - applies to the column where the user can use the logical "or" or "and" search. This does the opposite of the "filter-match" class, and overrides it if applied.</li>
<li><code>filter-false</code> - disable the filter for a specific header column.</li>
<li><code>filter-select</code> - build a default select box for a column (shows unique column content). See the <a href="example-widget-filter-custom.html">custom filter widget</a> demo for an example.</li>
<li><code>filter-select-nosort</code> - when a default select box is built, this option prevents the sorting of select options leaving them in their original table order (<span class="version">v2.16.3</span>).</li>
<li><code>filter-select-sort-desc</code> - when a default select box is built, it is automatically set to an ascending sort. Adding this class name will perform a descending sort on the values (<span class="version">v2.27.7</span>).</li>
<li><code>filter-match</code> - applies to "filter-select" columns and columns where the user can use the logical "or" search. Makes the filter/select match the column contents instead of exactly matching.</li>
<li><code>filter-parsed</code> - set a column to filter through parsed data instead of the actual table cell content.</li>
<li><code>filter-onlyAvail</code>
<ul>
<li>Show only available (visible) options within a default select box.</li>
<li>This class name is set by the <code>filter_onlyAvail</code> option.</li>
<li>See the <a href="example-widget-filter-custom.html">custom filter widget</a> demo "Discount" column for an example.</li>
</ul>
</li>
</ul>
</div>
<h3><a href="#">Methods</a></h3>
<div>
<h3 id="method-placeholder">Set Filter Placeholder Text</h3>
<blockquote>
Set a <code>data-placeholder</code> attribute on the associated table header with your desired placeholder text
<pre class="prettyprint lang-html"><th data-placeholder="Enter Something">Name</th></pre>
or, set the header cell's jQuery data
<pre class="prettyprint lang-javascript">$('.tablesorter th:eq(0)').data('placeholder', 'Search for...')</pre>
</blockquote>
<h3 id="method-initial-search">Set Filter Initial Searches</h3>
<blockquote>
Set a <code>data-value</code> attribute (data-attribute name set by the <code>filter_defaultAttrib</code> option) on the associated table header with the desired initial search value.
<pre class="prettyprint lang-html"><th data-value="<=100">Price</th></pre>
or, set the header cell's jQuery data
<pre class="prettyprint lang-javascript">$('.tablesorter th:eq(0)').data('value', '<=100')</pre>
</blockquote>
<h3 id="method-reset">filterReset</h3>
<blockquote>
Use the <code>filterReset</code> method to reset (clear) all of the current filters as follows:
<pre class="prettyprint lang-javascript">$('table').trigger('filterReset');</pre>
or, just add an element to your page and point to it by setting the <code>filter_reset</code> option, to allow user interaction.
<p></p>
<span class="label label-info">*NOTE*</span> delegated event bindings are used so these "reset" elements can be dynamically added and removed from the document.
</blockquote>
<h3 id="method-reset">filterResetSaved</h3>
<blockquote>
Use the <code>filterResetSaved</code> method to reset (clear) the saved filters (in storage) as follows (<span class="version">v2.25.6</span>):
<pre class="prettyprint lang-javascript">// equivalent to:
// $.tablesorter.storage( $('#table'), 'tablesorter-filters', '' );
$('#table').trigger('filterResetSaved');</pre>
</blockquote>
<h3 id="method-search">Search</h3>
<blockquote>
With this method, you can pass an array of filter values:
<pre class="prettyprint lang-javascript">// apply "2?%" filter to the fifth column (zero-based index)
var columns = [];
columns[5] = '2?%';
// or define the array this way var columns = [ '', '', '', '', '', '2?%' ]
$('table').trigger('search', [ columns ]);</pre>
or, just pass <code>false</code> to refresh the current search:
<pre class="prettyprint lang-javascript">$('table').trigger('search', false);</pre>
* Note: using this search method will update the contents of the filters within the filter row.<br>
<br>
In <span class="version updated">v2.15</span>, one additional parameter can be added to the array to perform an "any-match" of the table; <span class="label warning">Warning!</span> please note that if no external input (with a <code>data-column="all"</code> is attached using <a href="index.html#function-bindsearch"><code>bindSearch</code></a> function) is visible, the user will not know that a filter has been applied. <pre class="prettyprint lang-js">// in a table with 4 columns; set the 5th parameter to any-match
$('table').trigger( 'search', [['', '', '', '', 'orange']] ); // find orange in any column</pre>
</blockquote>
<h3 id="method-get-filters">Get current filters</h3>
<blockquote>
Get an array of the currently applied filters (<span class="version">v2.9</span>).
<pre class="prettyprint lang-javascript">$.tablesorter.getFilters( $('table') ); // or $('table.hasFilters')</pre>
This method returns an array of filter values or <code>false</code> if the selected table does not contain a filter row.<br>
<br>
Internally, the get filters functions returns the filters stored within this table data <code>$('table').data('lastSearch')</code>, unless an additional parameter of <code>true</code> is passed to the function:
<pre class="prettyprint lang-javascript">$.tablesorter.getFilters( $('table'), true ); // get current input values instead of data stored filters</pre>
As of <span class="version updated">v2.15</span>, if an external "any-match" filter (see <code>filter_external</code> widget option) is included, one additional array parameter will be returned in the filter - the value of the any match search.
<pre class="prettyprint lang-js">// in a table with six columns, this function will return an array with seven
// parameters; something like this: [ '', '', '', '', '', '', '11' ],
// where the "11" will be obtained from the "any-match" input
var filters = $.tablesorter.getFilters( $('table') );</pre>
</blockquote>
<h3 id="method-set-filters">Set current filters</h3>
<blockquote>
Set the values of the actual filters using this method; include a <code>false</code> boolean to not apply the search (<span class="version">v2.9</span>).
<p>In <span class="version update">v2.24.3</span>, if the last boolean parameter is <code>undefined</code> or set to <code>true</code>, the search <em>will be applied</em>. Only when the boolean is set to <code>false</code> will the search <em>not</em> be applied!</p>
<pre class="prettyprint lang-javascript">// update filters, AND apply the search
$.tablesorter.setFilters( $('table'), [ '', '', '', '', '', '2?%' ] ); // , true is optional
// update filters, but DOES NOT apply the search
$.tablesorter.setFilters( $('table'), [ '', '', '', '', '', '2?%' ], false );</pre>
This method returns <code>true</code> if the filters were sucessfully applied, or <code>false</code> if the table does have a filter row.<br>
<br>
As of <span class="version updated">v2.15</span>, if an external "any-match" filter (see <code>filter_external</code> widget option) is included, add an additional array parameter to set that filter; so if a table has six columns, add the any-match search as the seventh value.
<pre class="prettyprint lang-js">// in a table with 6 columns, the 7th filter will apply
// to the any-match filter & match any table column with "11"
$.tablesorter.setFilters( $('table'), [ '', '', '', '', '', '', '11' ], true );</pre>
</blockquote>
<h3 id="method-bind-filters">Bind external filter</h3>
<blockquote>
Use this method to bind external search filters
<ul>
<li>Include a data-attribute <code>data-column</code> with the column index to target</li>
<li>Or, use <code>data-column="all"</code> to preform an "any-match" search on all of the table columns (<span class="version updated">v2.15</span>).</li>
<li>Or, add multiple columns <code>data-column="0-2,4,6-8"</code> to perform an "any-match" search on selected columns (<span class="version">v2.18.0</span>).</li>
</ul>
If no <code>data-column</code> is added to the input, the input will be ignored.
<pre class="prettyprint lang-html"><!-- will perform an "any-match" type of search (matches any column) -->
<input type="search" class="search" data-column="all">
<!-- will only search the first column (zero-based index) -->
<input type="search" class="search" data-column="0"></pre>
<pre class="prettyprint lang-javascript">// Target the $('.search') input using built in functioning
// this binds to the search using "search" and "keyup" and allows using filter_liveSearch
// or delayed search & pressing escape to cancel the search
// pass an optional third parameter (false boolean) to force the inputs to update
// this allows changing the data-column for an input dynamically
$.tablesorter.filter.bindSearch( $table, $('.search'), false );</pre>
If you don't care about the enhanced search filter, then bind to both the "keyup" and "search" events
<pre class="prettyprint lang-javascript">// 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] ]);
});
</pre></blockquote>
</div>
<h3><a href="#">Events</a></h3>
<div>
<ul>
<li><code>filterEnd</code> - Event triggered when the filter widget has finished processing the search.</li>
<li><code>filterInit</code> - Event triggered when the filter widget has finished initializing.</li>
<li><code>filterStart</code> - Event triggered when the filter widget has started processing the search.</li>
</ul>
</div>
<h3><a href="#">Changes</a></h3>
<div class="inner">
Moved to the wiki pages - <a href="https://github.com/Mottie/tablesorter/wiki/Changes">change log</a>.
</div>
<h3><a href="#">Localization</a></h3>
<div class="inner">
You can now change the language of the searches used within the filter widget. For example, to change the localization to French, do the following:
<pre class="prettyprint lang-js">// add French support
$.extend($.tablesorter.language, {
to : 'à',
or : 'ou',
and : 'et'
});</pre>If you want to support multiple languages, separate the language variables with a vertical bar (<code>|</code>, <kbd>Shift</kbd> + <kbd>\</kbd>):
<pre class="prettyprint lang-js">// add French & Spanish support
$.extend($.tablesorter.language, {
to : 'à|a',
or : 'ou|o',
and : 'et|y'
});</pre>
<h3>Notes</h3>
<ul>
<li><span class="label label-info">Info</span> These changes still require the user to enter spaces in the filter to perform the search, e.g. <code>1 à 10</code> (shows rows with numbers between 1 and 10).</li>
<li><span class="label label-info">Info</span> Extra spaces around the value will be trimmed and it is valid to set a value to an empty string; but this won't disable the filter type (use <code>-</code> for "to", <code>|</code> for "or" and <code>&&</code> for "and").</li>
<li>
<span class="label warning">Warning</span> These language values are added to a regular expression using <code>new RegExp()</code>:
<ul>
<li>So you will need to escape any special characters contained in these values (e.g. <code>. \ + * ? [ ^ ] $ ( ) { } = ! < > | : -</code>).</li>
<li>This function might help (<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions#Using_special_characters">ref</a>):
<pre class="prettyprint lang-js">function escapeRegExp( string ) {
return string.replace( /[.*+?^${}()|[\]\\]/g, '\\$&' );
}</pre>
</li>
</ul>
</li>
</ul>
</div>
</div>
<p></p>
<h1>Demo</h1>
<button type="button" class="toggle fsw">Toggle</button> filter_startsWith : <span id="start">false</span> (if true, search from beginning of cell content only)<br>
<button type="button" class="toggle fic">Toggle</button> filter_ignoreCase : <span id="case">true</span> (if false, the search will be case sensitive)<br>
<button type="button" class="toggle ffm">Toggle</button> filter-match (if class name added to the "First Name" column, all "or" searches will only match the content; Search <button type="button" data-filter-column="1">alex|br*|c</button> in the First Name column (<span class="version">2.10.1</span>).
<hr>
<div id="demo">Search <button type="button" data-filter-column="5" data-filter-text="2?%">2?%</button> in the Discount column<br>
<button type="button" class="reset">Reset</button> <!-- targeted by the "filter_reset" option -->
<button type="button" class="resetsaved" title="Reload the page to see that the saved filters have cleared">Reset Saved Filters</button>
<table id="table" class="tablesorter">
<thead>
<tr>
<!-- you can also add a placeholder using script; $('.tablesorter th:eq(0)').data('placeholder', 'hello') -->
<th data-placeholder="" class="filter-false">Rank</th>
<th data-placeholder="Try B*{space} or alex|br*|c" data-label="First Name" data-test="" class="filter-match">First Name (<span></span> filter-match )</th>
<th data-placeholder="Try <d">Last Name</th>
<th data-placeholder="Try >=33">Age</th>
<th data-placeholder="Try <9.99">Total</th>
<th data-placeholder="Try 2?%">Discount</th> <!-- add class="filter-false" to disable the filter in this column -->
<th data-placeholder="Try /20[^0]\d/ or >1/1/2010">Date</th>
</tr>
</thead>
<tbody>
<tr><td>1</td><td>Philip Aaron Wong</td><td>Johnson Sr Esq</td><td>25</td><td>$5.95</td><td>22%</td><td>Jun 26, 2004 7:22 AM</td></tr>
<tr><td>11</td><td>Aaron</td><td>Hibert</td><td>12</td><td>$2.99</td><td>5%</td><td>Aug 21, 2009 12:21 PM</td></tr>
<tr><td>12</td><td>Brandon Clark</td><td>Henry Jr</td><td>51</td><td>$42.29</td><td>18%</td><td>Oct 13, 2000 1:15 PM</td></tr>
<tr><td>111</td><td>Peter</td><td>Parker</td><td>28</td><td>$9.99</td><td>20%</td><td>Jul 6, 2006 8:14 AM</td></tr>
<tr><td>21</td><td>John</td><td>Hood</td><td>33</td><td>$19.99</td><td>25%</td><td>Dec 10, 2002 5:14 AM</td></tr>
<tr><td>013</td><td>Clark</td><td>Kent Sr.</td><td>18</td><td>$15.89</td><td>44%</td><td>Jan 12, 2003 11:14 AM</td></tr>
<tr><td>005</td><td>Bruce</td><td>Almighty Esq</td><td>45</td><td>$153.19</td><td>44%</td><td>Jan 18, 2021 9:12 AM</td></tr>
<tr><td>10</td><td>Alex</td><td>Dumass</td><td>13</td><td>$5.29</td><td>4%</td><td>Jan 8, 2012 5:11 PM</td></tr>
<tr><td>16</td><td>Jim</td><td>Franco</td><td>24</td><td>$14.19</td><td>14%</td><td>Jan 14, 2004 11:23 AM</td></tr>
<tr><td>166</td><td>Bruce Lee</td><td>Evans</td><td>22</td><td>$13.19</td><td>11%</td><td>Jan 18, 2007 9:12 AM</td></tr>
<tr><td>100</td><td>Brenda Dexter</td><td>McMasters</td><td>18</td><td>$55.20</td><td>15%</td><td>Feb 12, 2010 7:23 PM</td></tr>
<tr><td>55</td><td>Dennis</td><td>Bronson</td><td>65</td><td>$123.00</td><td>32%</td><td>Jan 20, 2001 1:12 PM</td></tr>
<tr><td>9</td><td>Martha</td><td>delFuego</td><td>25</td><td>$22.09</td><td>17%</td><td>Jun 11, 2011 10:55 AM</td></tr>
</tbody>
</table></div>
<h1>Page Header</h1>
<div>
<pre class="prettyprint lang-html"><!-- blue theme stylesheet -->
<link rel="stylesheet" href="css/theme.blue.css">
<!-- tablesorter plugin -->
<script src="js/jquery-latest.min.js"></script>
<script src="js/jquery.tablesorter.js"></script>
<!-- tablesorter widget file - loaded after the plugin -->
<script src="js/jquery.tablesorter.widgets.js"></script></pre>
</div>
<h1>Javascript</h1>
<div id="javascript">
<pre class="prettyprint lang-javascript"></pre>
</div>
<h1>CSS</h1>
<div>
<pre class="prettyprint lang-css">/* REQUIRED in CUSTOM THEMES!
This is the only definition that MUST BE added to any custom themes.
This is how rows are hidden by filtering (included in provided themes) */
.tablesorter .filtered {
display: none;
}
/* All of the following css is already contained within each theme file; modify it as desired */
/* filter row */
.tablesorter-filter-row td {
background: #eee;
line-height: normal;
text-align: center; /* center the input */
-webkit-transition: line-height 0.1s ease;
-moz-transition: line-height 0.1s ease;
-o-transition: line-height 0.1s ease;
transition: line-height 0.1s ease;
}
/* optional disabled input styling */
.tablesorter-filter-row .disabled {
opacity: 0.5;
filter: alpha(opacity=50);
cursor: not-allowed;
}
/* hidden filter row */
.tablesorter-filter-row.hideme td {
/*** *********************************************** ***/
/*** change this padding to modify the thickness ***/
/*** of the closed filter row (height = padding x 2) ***/
padding: 2px;
/*** *********************************************** ***/
margin: 0;
line-height: 0;
cursor: pointer;
}
.tablesorter-filter-row.hideme * {
height: 1px;
min-height: 0;
border: 0;
padding: 0;
margin: 0;
/* don't use visibility: hidden because it disables tabbing */
opacity: 0;
filter: alpha(opacity=0);
}
/* filters */
.tablesorter-filter {
width: 95%;
height: inherit;
margin: 4px;
padding: 4px;
background-color: #fff;
border: 1px solid #bbb;
color: #333;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
-webkit-transition: height 0.1s ease;
-moz-transition: height 0.1s ease;
-o-transition: height 0.1s ease;
transition: height 0.1s ease;
}</pre>
</div>
<h1>HTML</h1>
<div id="html">
<pre class="prettyprint lang-html"></pre>
</div>
<div class="next-up">
<hr />
Next up: <a href="example-widget-filter-any-match.html">jQuery Any Match filter widget ››</a>
</div>
</div>
</body>
</html>
|