1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
4 <meta http-equiv="content-type" content="text/html; charset=utf-8" />
5 <link rel="shortcut icon" type="image/ico" href="http://www.datatables.net/media/images/favicon.ico" />
7 <title>DataTables example</title>
8 <style type="text/css" title="currentStyle">
9 @import "../../media/css/demo_page.css";
10 @import "../../media/css/demo_table.css";
12 <script type="text/javascript" language="javascript" src="../../media/js/jquery.js"></script>
13 <script type="text/javascript" language="javascript" src="../../media/js/jquery.dataTables.js"></script>
14 <script type="text/javascript" charset="utf-8">
15 var asInitVals = new Array();
17 $(document).ready(function() {
18 var oTable = $('#example').dataTable( {
20 "sSearch": "Search all columns:"
24 $("tfoot input").keyup( function () {
25 /* Filter on the column (the index) of this element */
26 oTable.fnFilter( this.value, $("tfoot input").index(this) );
32 * Support functions to provide a little bit of 'user friendlyness' to the textboxes in
35 $("tfoot input").each( function (i) {
36 asInitVals[i] = this.value;
39 $("tfoot input").focus( function () {
40 if ( this.className == "search_init" )
47 $("tfoot input").blur( function (i) {
48 if ( this.value == "" )
50 this.className = "search_init";
51 this.value = asInitVals[$("tfoot input").index(this)];
57 <body id="dt_example">
59 <div class="full_width big">
60 DataTables individual column filtering example
64 <p>The filtering functionality that is provided by DataTables is very useful for quickly search through the information in the table - however the search is global, and you (or the end user) may wish to filter only on a particular column of data. To met this need the DataTables <b>fnFilter()</b> API function allow you to specify a column to limit to search to. Note that this works in-combination with the global search filter. Further note that because the input elements are outside of the control of DataTables, with state saving enabled, stored values are not automatically restored - please see <a href="http://datatables.net/forums/comments.php?DiscussionID=2864#Item_3">this post in the forum</a> for how to do this.</p>
65 <p>The example below shows a table which has a text input box for each column in the footer element of the table. This allows the data in each column to be quickly filtered upon by the end user.</p>
69 <table cellpadding="0" cellspacing="0" border="0" class="display" id="example">
72 <th>Rendering engine</th>
75 <th>Engine version</th>
85 <td class="center">4</td>
86 <td class="center">X</td>
93 <td class="center">5</td>
94 <td class="center">C</td>
101 <td class="center">5.5</td>
102 <td class="center">A</td>
109 <td class="center">6</td>
110 <td class="center">A</td>
114 <td>Internet Explorer 7</td>
116 <td class="center">7</td>
117 <td class="center">A</td>
121 <td>AOL browser (AOL desktop)</td>
123 <td class="center">6</td>
124 <td class="center">A</td>
129 <td>Win 98+ / OSX.2+</td>
130 <td class="center">1.7</td>
131 <td class="center">A</td>
136 <td>Win 98+ / OSX.2+</td>
137 <td class="center">1.8</td>
138 <td class="center">A</td>
143 <td>Win 98+ / OSX.2+</td>
144 <td class="center">1.8</td>
145 <td class="center">A</td>
150 <td>Win 2k+ / OSX.3+</td>
151 <td class="center">1.9</td>
152 <td class="center">A</td>
158 <td class="center">1.8</td>
159 <td class="center">A</td>
165 <td class="center">1.8</td>
166 <td class="center">A</td>
170 <td>Netscape 7.2</td>
171 <td>Win 95+ / Mac OS 8.6-9.2</td>
172 <td class="center">1.7</td>
173 <td class="center">A</td>
177 <td>Netscape Browser 8</td>
179 <td class="center">1.7</td>
180 <td class="center">A</td>
184 <td>Netscape Navigator 9</td>
185 <td>Win 98+ / OSX.2+</td>
186 <td class="center">1.8</td>
187 <td class="center">A</td>
192 <td>Win 95+ / OSX.1+</td>
193 <td class="center">1</td>
194 <td class="center">A</td>
199 <td>Win 95+ / OSX.1+</td>
200 <td class="center">1.1</td>
201 <td class="center">A</td>
206 <td>Win 95+ / OSX.1+</td>
207 <td class="center">1.2</td>
208 <td class="center">A</td>
213 <td>Win 95+ / OSX.1+</td>
214 <td class="center">1.3</td>
215 <td class="center">A</td>
220 <td>Win 95+ / OSX.1+</td>
221 <td class="center">1.4</td>
222 <td class="center">A</td>
227 <td>Win 95+ / OSX.1+</td>
228 <td class="center">1.5</td>
229 <td class="center">A</td>
234 <td>Win 95+ / OSX.1+</td>
235 <td class="center">1.6</td>
236 <td class="center">A</td>
241 <td>Win 98+ / OSX.1+</td>
242 <td class="center">1.7</td>
243 <td class="center">A</td>
248 <td>Win 98+ / OSX.1+</td>
249 <td class="center">1.8</td>
250 <td class="center">A</td>
254 <td>Seamonkey 1.1</td>
255 <td>Win 98+ / OSX.2+</td>
256 <td class="center">1.8</td>
257 <td class="center">A</td>
261 <td>Epiphany 2.20</td>
263 <td class="center">1.8</td>
264 <td class="center">A</td>
270 <td class="center">125.5</td>
271 <td class="center">A</td>
277 <td class="center">312.8</td>
278 <td class="center">A</td>
284 <td class="center">419.3</td>
285 <td class="center">A</td>
291 <td class="center">522.1</td>
292 <td class="center">A</td>
298 <td class="center">420</td>
299 <td class="center">A</td>
303 <td>iPod Touch / iPhone</td>
305 <td class="center">420.1</td>
306 <td class="center">A</td>
312 <td class="center">413</td>
313 <td class="center">A</td>
318 <td>Win 95+ / OSX.1+</td>
319 <td class="center">-</td>
320 <td class="center">A</td>
325 <td>Win 95+ / OSX.2+</td>
326 <td class="center">-</td>
327 <td class="center">A</td>
332 <td>Win 95+ / OSX.2+</td>
333 <td class="center">-</td>
334 <td class="center">A</td>
339 <td>Win 95+ / OSX.2+</td>
340 <td class="center">-</td>
341 <td class="center">A</td>
346 <td>Win 95+ / OSX.3+</td>
347 <td class="center">-</td>
348 <td class="center">A</td>
353 <td>Win 88+ / OSX.3+</td>
354 <td class="center">-</td>
355 <td class="center">A</td>
360 <td>Win 88+ / OSX.3+</td>
361 <td class="center">-</td>
362 <td class="center">A</td>
366 <td>Opera for Wii</td>
368 <td class="center">-</td>
369 <td class="center">A</td>
375 <td class="center">-</td>
376 <td class="center">A</td>
380 <td>Nintendo DS browser</td>
382 <td class="center">8.5</td>
383 <td class="center">C/A<sup>1</sup></td>
387 <td>Konqureror 3.1</td>
389 <td class="center">3.1</td>
390 <td class="center">C</td>
394 <td>Konqureror 3.3</td>
396 <td class="center">3.3</td>
397 <td class="center">A</td>
401 <td>Konqureror 3.5</td>
403 <td class="center">3.5</td>
404 <td class="center">A</td>
408 <td>Internet Explorer 4.5</td>
410 <td class="center">-</td>
411 <td class="center">X</td>
415 <td>Internet Explorer 5.1</td>
416 <td>Mac OS 7.6-9</td>
417 <td class="center">1</td>
418 <td class="center">C</td>
422 <td>Internet Explorer 5.2</td>
424 <td class="center">1</td>
425 <td class="center">C</td>
429 <td>NetFront 3.1</td>
430 <td>Embedded devices</td>
431 <td class="center">-</td>
432 <td class="center">C</td>
436 <td>NetFront 3.4</td>
437 <td>Embedded devices</td>
438 <td class="center">-</td>
439 <td class="center">A</td>
444 <td>Embedded devices</td>
445 <td class="center">-</td>
446 <td class="center">X</td>
452 <td class="center">-</td>
453 <td class="center">X</td>
459 <td class="center">-</td>
460 <td class="center">X</td>
465 <td>Windows Mobile 6</td>
466 <td class="center">-</td>
467 <td class="center">C</td>
473 <td class="center">-</td>
474 <td class="center">C</td>
477 <td>Other browsers</td>
480 <td class="center">-</td>
481 <td class="center">U</td>
486 <th><input type="text" name="search_engine" value="Search engines" class="search_init" /></th>
487 <th><input type="text" name="search_browser" value="Search browsers" class="search_init" /></th>
488 <th><input type="text" name="search_platform" value="Search platforms" class="search_init" /></th>
489 <th><input type="text" name="search_version" value="Search versions" class="search_init" /></th>
490 <th><input type="text" name="search_grade" value="Search grades" class="search_init" /></th>
495 <div class="spacer"></div>
498 <h1>Initialisation code</h1>
499 <pre class="brush: js;">var asInitVals = new Array();
501 $(document).ready(function() {
502 var oTable = $('#example').dataTable( {
504 "sSearch": "Search all columns:"
508 $("tfoot input").keyup( function () {
509 /* Filter on the column (the index) of this element */
510 oTable.fnFilter( this.value, $("tfoot input").index(this) );
516 * Support functions to provide a little bit of 'user friendlyness' to the textboxes in
519 $("tfoot input").each( function (i) {
520 asInitVals[i] = this.value;
523 $("tfoot input").focus( function () {
524 if ( this.className == "search_init" )
531 $("tfoot input").blur( function (i) {
532 if ( this.value == "" )
534 this.className = "search_init";
535 this.value = asInitVals[$("tfoot input").index(this)];
539 <style type="text/css">
540 @import "../examples_support/syntax/css/shCore.css";
542 <script type="text/javascript" language="javascript" src="../examples_support/syntax/js/shCore.js"></script>
543 <p>Note that in the above code, the support functions are provided to ensure that the end user knows what data is being filtered upon. <b>fnFilter()</b> is the function of primary import here.</p>
546 <h1>Other examples</h1>
547 <div class="demo_links">
548 <h2>Basic initialisation</h2>
550 <li><a href="../basic_init/zero_config.html">Zero configuration</a></li>
551 <li><a href="../basic_init/filter_only.html">Feature enablement</a></li>
552 <li><a href="../basic_init/table_sorting.html">Sorting data</a></li>
553 <li><a href="../basic_init/multi_col_sort.html">Multi-column sorting</a></li>
554 <li><a href="../basic_init/multiple_tables.html">Multiple tables</a></li>
555 <li><a href="../basic_init/hidden_columns.html">Hidden columns</a></li>
556 <li><a href="../basic_init/complex_header.html">Complex headers - grouping with colspan</a></li>
557 <li><a href="../basic_init/dom.html">DOM positioning</a></li>
558 <li><a href="../basic_init/flexible_width.html">Flexible table width</a></li>
559 <li><a href="../basic_init/state_save.html">State saving</a></li>
560 <li><a href="../basic_init/alt_pagination.html">Alternative pagination styles</a></li>
562 <a href="../basic_init/scroll_x.html">Horizontal</a> /
563 <a href="../basic_init/scroll_y.html">Vertical</a> /
564 <a href="../basic_init/scroll_xy.html">Both</a> /
565 <a href="../basic_init/scroll_y_theme.html">Themed</a> /
566 <a href="../basic_init/scroll_y_infinite.html">Infinite</a>
568 <li><a href="../basic_init/language.html">Change language information (internationalisation)</a></li>
569 <li><a href="../basic_init/themes.html">ThemeRoller themes (Smoothness)</a></li>
572 <h2>Advanced initialisation</h2>
575 <a href="../advanced_init/events_live.html">Live events</a> /
576 <a href="../advanced_init/events_pre_init.html">Pre-init</a> /
577 <a href="../advanced_init/events_post_init.html">Post-init</a>
579 <li><a href="../advanced_init/column_render.html">Column rendering</a></li>
580 <li><a href="../advanced_init/html_sort.html">Sorting without HTML tags</a></li>
581 <li><a href="../advanced_init/dom_multiple_elements.html">Multiple table controls (sDom)</a></li>
582 <li><a href="../advanced_init/length_menu.html">Defining length menu options</a></li>
583 <li><a href="../advanced_init/complex_header.html">Complex headers and hidden columns</a></li>
584 <li><a href="../advanced_init/dom_toolbar.html">Custom toolbar (element) around table</a></li>
585 <li><a href="../advanced_init/highlight.html">Row highlighting with CSS</a></li>
586 <li><a href="../advanced_init/row_grouping.html">Row grouping</a></li>
587 <li><a href="../advanced_init/row_callback.html">Row callback</a></li>
588 <li><a href="../advanced_init/footer_callback.html">Footer callback</a></li>
589 <li><a href="../advanced_init/sorting_control.html">Control sorting direction of columns</a></li>
590 <li><a href="../advanced_init/language_file.html">Change language information from a file (internationalisation)</a></li>
591 <li><a href="../advanced_init/defaults.html">Setting defaults</a></li>
592 <li><a href="../advanced_init/localstorage.html">State saving with localStorage</a></li>
593 <li><a href="../advanced_init/dt_events.html">Custom events</a></li>
598 <li><a href="../api/add_row.html">Dynamically add a new row</a></li>
599 <li><a href="../api/multi_filter.html">Individual column filtering (using "input" elements)</a></li>
600 <li><a href="../api/multi_filter_select.html">Individual column filtering (using "select" elements)</a></li>
601 <li><a href="../api/highlight.html">Highlight rows and columns</a></li>
602 <li><a href="../api/row_details.html">Show and hide details about a particular record</a></li>
603 <li><a href="../api/select_row.html">User selectable rows (multiple rows)</a></li>
604 <li><a href="../api/select_single_row.html">User selectable rows (single row) and delete rows</a></li>
605 <li><a href="../api/editable.html">Editable rows (with jEditable)</a></li>
606 <li><a href="../api/form.html">Submit form with elements in table</a></li>
607 <li><a href="../api/counter_column.html">Index column (static number column)</a></li>
608 <li><a href="../api/show_hide.html">Show and hide columns dynamically</a></li>
609 <li><a href="../api/api_in_init.html">API function use in initialisation object (callback)</a></li>
610 <li><a href="../api/tabs_and_scrolling.html">DataTables scrolling and tabs</a></li>
611 <li><a href="../api/regex.html">Regular expression filtering</a></li>
615 <div class="demo_links">
616 <h2>Data sources</h2>
618 <li><a href="../data_sources/dom.html">DOM</a></li>
619 <li><a href="../data_sources/js_array.html">Javascript array</a></li>
620 <li><a href="../data_sources/ajax.html">Ajax source</a></li>
621 <li><a href="../data_sources/server_side.html">Server side processing</a></li>
624 <h2>Server-side processing</h2>
626 <li><a href="../server_side/server_side.html">Obtain server-side data</a></li>
627 <li><a href="../server_side/custom_vars.html">Add extra HTTP variables</a></li>
628 <li><a href="../server_side/post.html">Use HTTP POST</a></li>
629 <li><a href="../server_side/ids.html">Automatic addition of IDs and classes to rows</a></li>
630 <li><a href="../server_side/object_data.html">Reading table data from objects</a></li>
631 <li><a href="../server_side/row_details.html">Show and hide details about a particular record</a></li>
632 <li><a href="../server_side/select_rows.html">User selectable rows (multiple rows)</a></li>
633 <li><a href="../server_side/jsonp.html">JSONP for a cross domain data source</a></li>
634 <li><a href="../server_side/editable.html">jEditable integration with DataTables</a></li>
635 <li><a href="../server_side/defer_loading.html">Deferred loading of Ajax data</a></li>
636 <li><a href="../server_side/pipeline.html">Pipelining data (reduce Ajax calls for paging)</a></li>
639 <h2>Ajax data source</h2>
641 <li><a href="../ajax/ajax.html">Ajax sourced data (array of arrays)</a></li>
642 <li><a href="../ajax/objects.html">Ajax sourced data (array of objects)</a></li>
643 <li><a href="../ajax/defer_render.html">Deferred DOM creation for extra speed</a></li>
644 <li><a href="../ajax/null_data_source.html">Empty data source columns</a></li>
645 <li><a href="../ajax/custom_data_property.html">Use a data source other than aaData (the default)</a></li>
646 <li><a href="../ajax/objects_subarrays.html">Read column data from sub-arrays</a></li>
647 <li><a href="../ajax/deep.html">Read column data from deeply nested properties</a></li>
652 <li><a href="../plug-ins/plugin_api.html">Add custom API functions</a></li>
653 <li><a href="../plug-ins/sorting_plugin.html">Sorting and automatic type detection</a></li>
654 <li><a href="../plug-ins/sorting_sType.html">Sorting without automatic type detection</a></li>
655 <li><a href="../plug-ins/paging_plugin.html">Custom pagination controls</a></li>
656 <li><a href="../plug-ins/range_filtering.html">Range filtering / custom filtering</a></li>
657 <li><a href="../plug-ins/dom_sort.html">Live DOM sorting</a></li>
658 <li><a href="../plug-ins/html_sort.html">Automatic HTML type detection</a></li>
663 <div id="footer" class="clear" style="text-align:center;">
665 Please refer to the <a href="http://www.datatables.net/usage">DataTables documentation</a> for full information about its API properties and methods.<br>
666 Additionally, there are a wide range of <a href="http://www.datatables.net/extras">extras</a> and <a href="http://www.datatables.net/plug-ins">plug-ins</a> which extend the capabilities of DataTables.
669 <span style="font-size:10px;">
670 DataTables designed and created by <a href="http://www.sprymedia.co.uk">Allan Jardine</a> © 2007-2011<br>
671 DataTables is dual licensed under the <a href="http://www.datatables.net/license_gpl2">GPL v2 license</a> or a <a href="http://www.datatables.net/license_bsd">BSD (3-point) license</a>.