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";
11 @import "../examples_support/jquery.tooltip.css";
13 <script type="text/javascript" language="javascript" src="../../media/js/jquery.js"></script>
14 <script type="text/javascript" language="javascript" src="../../media/js/jquery.dataTables.js"></script>
15 <script type="text/javascript" language="javascript" src="../examples_support/jquery.tooltip.js"></script>
16 <script type="text/javascript" charset="utf-8">
17 $(document).ready(function() {
19 * First step is to create title attributes for the rows in the table
20 * This isn't needed if the required 'title' attribute is already set in the HTML in the
23 $('#example tbody tr').each( function() {
25 var nTds = $('td', this);
26 var sBrowser = $(nTds[1]).text();
27 var sGrade = $(nTds[4]).text();
30 sTitle = sBrowser+' will provide a first class (A) level of CSS support.';
31 else if ( sGrade == "C" )
32 sTitle = sBrowser+' will provide a core (C) level of CSS support.';
33 else if ( sGrade == "X" )
34 sTitle = sBrowser+' does not provide CSS support or has a broken implementation. Block CSS.';
36 sTitle = sBrowser+' will provide an undefined level of CSS support.';
38 this.setAttribute( 'title', sTitle );
42 var oTable = $('#example').dataTable();
44 /* Apply the tooltips */
45 oTable.$('tr').tooltip( {
53 <body id="dt_example">
55 <div class="full_width big">
56 DataTables events (post-initialisation) example
60 <p>Events which are assigned to the table elements are retained by DataTables such that they will still work as you would expect, even after changing the sort order etc. (no need to reapply the event handlers). You can do this at any time, although if you apply the handlers after the table has been initialised there is an extra set. Rather then querying the DOM to get all rows (since they aren't there) you can use the '$' API method that DataTables provides which does a jQuery selector on the whole table and returns a jQuery object.</p>
61 <p>This example shows the tooltip plug-in being applied to the table after initialisation.</p>
65 <table cellpadding="0" cellspacing="0" border="0" class="display" id="example">
68 <th>Rendering engine</th>
71 <th>Engine version</th>
83 <td class="center">4</td>
84 <td class="center">X</td>
91 <td class="center">5</td>
92 <td class="center">C</td>
99 <td class="center">5.5</td>
100 <td class="center">A</td>
107 <td class="center">6</td>
108 <td class="center">A</td>
112 <td>Internet Explorer 7</td>
114 <td class="center">7</td>
115 <td class="center">A</td>
119 <td>AOL browser (AOL desktop)</td>
121 <td class="center">6</td>
122 <td class="center">A</td>
127 <td>Win 98+ / OSX.2+</td>
128 <td class="center">1.7</td>
129 <td class="center">A</td>
134 <td>Win 98+ / OSX.2+</td>
135 <td class="center">1.8</td>
136 <td class="center">A</td>
141 <td>Win 98+ / OSX.2+</td>
142 <td class="center">1.8</td>
143 <td class="center">A</td>
148 <td>Win 2k+ / OSX.3+</td>
149 <td class="center">1.9</td>
150 <td class="center">A</td>
156 <td class="center">1.8</td>
157 <td class="center">A</td>
163 <td class="center">1.8</td>
164 <td class="center">A</td>
168 <td>Netscape 7.2</td>
169 <td>Win 95+ / Mac OS 8.6-9.2</td>
170 <td class="center">1.7</td>
171 <td class="center">A</td>
175 <td>Netscape Browser 8</td>
177 <td class="center">1.7</td>
178 <td class="center">A</td>
182 <td>Netscape Navigator 9</td>
183 <td>Win 98+ / OSX.2+</td>
184 <td class="center">1.8</td>
185 <td class="center">A</td>
190 <td>Win 95+ / OSX.1+</td>
191 <td class="center">1</td>
192 <td class="center">A</td>
197 <td>Win 95+ / OSX.1+</td>
198 <td class="center">1.1</td>
199 <td class="center">A</td>
204 <td>Win 95+ / OSX.1+</td>
205 <td class="center">1.2</td>
206 <td class="center">A</td>
211 <td>Win 95+ / OSX.1+</td>
212 <td class="center">1.3</td>
213 <td class="center">A</td>
218 <td>Win 95+ / OSX.1+</td>
219 <td class="center">1.4</td>
220 <td class="center">A</td>
225 <td>Win 95+ / OSX.1+</td>
226 <td class="center">1.5</td>
227 <td class="center">A</td>
232 <td>Win 95+ / OSX.1+</td>
233 <td class="center">1.6</td>
234 <td class="center">A</td>
239 <td>Win 98+ / OSX.1+</td>
240 <td class="center">1.7</td>
241 <td class="center">A</td>
246 <td>Win 98+ / OSX.1+</td>
247 <td class="center">1.8</td>
248 <td class="center">A</td>
252 <td>Seamonkey 1.1</td>
253 <td>Win 98+ / OSX.2+</td>
254 <td class="center">1.8</td>
255 <td class="center">A</td>
259 <td>Epiphany 2.20</td>
261 <td class="center">1.8</td>
262 <td class="center">A</td>
268 <td class="center">125.5</td>
269 <td class="center">A</td>
275 <td class="center">312.8</td>
276 <td class="center">A</td>
282 <td class="center">419.3</td>
283 <td class="center">A</td>
289 <td class="center">522.1</td>
290 <td class="center">A</td>
296 <td class="center">420</td>
297 <td class="center">A</td>
301 <td>iPod Touch / iPhone</td>
303 <td class="center">420.1</td>
304 <td class="center">A</td>
310 <td class="center">413</td>
311 <td class="center">A</td>
316 <td>Win 95+ / OSX.1+</td>
317 <td class="center">-</td>
318 <td class="center">A</td>
323 <td>Win 95+ / OSX.2+</td>
324 <td class="center">-</td>
325 <td class="center">A</td>
330 <td>Win 95+ / OSX.2+</td>
331 <td class="center">-</td>
332 <td class="center">A</td>
337 <td>Win 95+ / OSX.2+</td>
338 <td class="center">-</td>
339 <td class="center">A</td>
344 <td>Win 95+ / OSX.3+</td>
345 <td class="center">-</td>
346 <td class="center">A</td>
351 <td>Win 88+ / OSX.3+</td>
352 <td class="center">-</td>
353 <td class="center">A</td>
358 <td>Win 88+ / OSX.3+</td>
359 <td class="center">-</td>
360 <td class="center">A</td>
364 <td>Opera for Wii</td>
366 <td class="center">-</td>
367 <td class="center">A</td>
373 <td class="center">-</td>
374 <td class="center">A</td>
378 <td>Nintendo DS browser</td>
380 <td class="center">8.5</td>
381 <td class="center">C/A<sup>1</sup></td>
385 <td>Konqureror 3.1</td>
387 <td class="center">3.1</td>
388 <td class="center">C</td>
392 <td>Konqureror 3.3</td>
394 <td class="center">3.3</td>
395 <td class="center">A</td>
399 <td>Konqureror 3.5</td>
401 <td class="center">3.5</td>
402 <td class="center">A</td>
406 <td>Internet Explorer 4.5</td>
408 <td class="center">-</td>
409 <td class="center">X</td>
413 <td>Internet Explorer 5.1</td>
414 <td>Mac OS 7.6-9</td>
415 <td class="center">1</td>
416 <td class="center">C</td>
420 <td>Internet Explorer 5.2</td>
422 <td class="center">1</td>
423 <td class="center">C</td>
427 <td>NetFront 3.1</td>
428 <td>Embedded devices</td>
429 <td class="center">-</td>
430 <td class="center">C</td>
434 <td>NetFront 3.4</td>
435 <td>Embedded devices</td>
436 <td class="center">-</td>
437 <td class="center">A</td>
442 <td>Embedded devices</td>
443 <td class="center">-</td>
444 <td class="center">X</td>
450 <td class="center">-</td>
451 <td class="center">X</td>
457 <td class="center">-</td>
458 <td class="center">X</td>
463 <td>Windows Mobile 6</td>
464 <td class="center">-</td>
465 <td class="center">C</td>
471 <td class="center">-</td>
472 <td class="center">C</td>
475 <td>Other browsers</td>
478 <td class="center">-</td>
479 <td class="center">U</td>
484 <th>Rendering engine</th>
487 <th>Engine version</th>
493 <div class="spacer"></div>
496 <h1>Initialisation code</h1>
497 <pre class="brush: js;">$(document).ready(function() {
499 * First step is to create title attributes for the rows in the table
500 * This isn't needed if the required 'title' attribute is already set in the HTML in the
503 $('#example tbody tr').each( function() {
505 var nTds = $('td', this);
506 var sBrowser = $(nTds[1]).text();
507 var sGrade = $(nTds[4]).text();
510 sTitle = sBrowser+' will provide a first class (A) level of CSS support.';
511 else if ( sGrade == "C" )
512 sTitle = sBrowser+' will provide a core (C) level of CSS support.';
513 else if ( sGrade == "X" )
514 sTitle = sBrowser+' does not provide CSS support or has a broken implementation. Block CSS.';
516 sTitle = sBrowser+' will provide an undefined level of CSS support.';
518 this.setAttribute( 'title', sTitle );
521 /* Init DataTables */
522 var oTable = $('#example').dataTable();
524 /* Apply the tooltips */
525 oTable.$('tr').tooltip( {
531 <style type="text/css">
532 @import "../examples_support/syntax/css/shCore.css";
534 <script type="text/javascript" language="javascript" src="../examples_support/syntax/js/shCore.js"></script>
537 <h1>Other examples</h1>
538 <div class="demo_links">
539 <h2>Basic initialisation</h2>
541 <li><a href="../basic_init/zero_config.html">Zero configuration</a></li>
542 <li><a href="../basic_init/filter_only.html">Feature enablement</a></li>
543 <li><a href="../basic_init/table_sorting.html">Sorting data</a></li>
544 <li><a href="../basic_init/multi_col_sort.html">Multi-column sorting</a></li>
545 <li><a href="../basic_init/multiple_tables.html">Multiple tables</a></li>
546 <li><a href="../basic_init/hidden_columns.html">Hidden columns</a></li>
547 <li><a href="../basic_init/complex_header.html">Complex headers - grouping with colspan</a></li>
548 <li><a href="../basic_init/dom.html">DOM positioning</a></li>
549 <li><a href="../basic_init/flexible_width.html">Flexible table width</a></li>
550 <li><a href="../basic_init/state_save.html">State saving</a></li>
551 <li><a href="../basic_init/alt_pagination.html">Alternative pagination styles</a></li>
553 <a href="../basic_init/scroll_x.html">Horizontal</a> /
554 <a href="../basic_init/scroll_y.html">Vertical</a> /
555 <a href="../basic_init/scroll_xy.html">Both</a> /
556 <a href="../basic_init/scroll_y_theme.html">Themed</a> /
557 <a href="../basic_init/scroll_y_infinite.html">Infinite</a>
559 <li><a href="../basic_init/language.html">Change language information (internationalisation)</a></li>
560 <li><a href="../basic_init/themes.html">ThemeRoller themes (Smoothness)</a></li>
563 <h2>Advanced initialisation</h2>
566 <a href="../advanced_init/events_live.html">Live events</a> /
567 <a href="../advanced_init/events_pre_init.html">Pre-init</a> /
568 <a href="../advanced_init/events_post_init.html">Post-init</a>
570 <li><a href="../advanced_init/column_render.html">Column rendering</a></li>
571 <li><a href="../advanced_init/html_sort.html">Sorting without HTML tags</a></li>
572 <li><a href="../advanced_init/dom_multiple_elements.html">Multiple table controls (sDom)</a></li>
573 <li><a href="../advanced_init/length_menu.html">Defining length menu options</a></li>
574 <li><a href="../advanced_init/complex_header.html">Complex headers and hidden columns</a></li>
575 <li><a href="../advanced_init/dom_toolbar.html">Custom toolbar (element) around table</a></li>
576 <li><a href="../advanced_init/highlight.html">Row highlighting with CSS</a></li>
577 <li><a href="../advanced_init/row_grouping.html">Row grouping</a></li>
578 <li><a href="../advanced_init/row_callback.html">Row callback</a></li>
579 <li><a href="../advanced_init/footer_callback.html">Footer callback</a></li>
580 <li><a href="../advanced_init/sorting_control.html">Control sorting direction of columns</a></li>
581 <li><a href="../advanced_init/language_file.html">Change language information from a file (internationalisation)</a></li>
582 <li><a href="../advanced_init/defaults.html">Setting defaults</a></li>
583 <li><a href="../advanced_init/localstorage.html">State saving with localStorage</a></li>
584 <li><a href="../advanced_init/dt_events.html">Custom events</a></li>
589 <li><a href="../api/add_row.html">Dynamically add a new row</a></li>
590 <li><a href="../api/multi_filter.html">Individual column filtering (using "input" elements)</a></li>
591 <li><a href="../api/multi_filter_select.html">Individual column filtering (using "select" elements)</a></li>
592 <li><a href="../api/highlight.html">Highlight rows and columns</a></li>
593 <li><a href="../api/row_details.html">Show and hide details about a particular record</a></li>
594 <li><a href="../api/select_row.html">User selectable rows (multiple rows)</a></li>
595 <li><a href="../api/select_single_row.html">User selectable rows (single row) and delete rows</a></li>
596 <li><a href="../api/editable.html">Editable rows (with jEditable)</a></li>
597 <li><a href="../api/form.html">Submit form with elements in table</a></li>
598 <li><a href="../api/counter_column.html">Index column (static number column)</a></li>
599 <li><a href="../api/show_hide.html">Show and hide columns dynamically</a></li>
600 <li><a href="../api/api_in_init.html">API function use in initialisation object (callback)</a></li>
601 <li><a href="../api/tabs_and_scrolling.html">DataTables scrolling and tabs</a></li>
602 <li><a href="../api/regex.html">Regular expression filtering</a></li>
606 <div class="demo_links">
607 <h2>Data sources</h2>
609 <li><a href="../data_sources/dom.html">DOM</a></li>
610 <li><a href="../data_sources/js_array.html">Javascript array</a></li>
611 <li><a href="../data_sources/ajax.html">Ajax source</a></li>
612 <li><a href="../data_sources/server_side.html">Server side processing</a></li>
615 <h2>Server-side processing</h2>
617 <li><a href="../server_side/server_side.html">Obtain server-side data</a></li>
618 <li><a href="../server_side/custom_vars.html">Add extra HTTP variables</a></li>
619 <li><a href="../server_side/post.html">Use HTTP POST</a></li>
620 <li><a href="../server_side/ids.html">Automatic addition of IDs and classes to rows</a></li>
621 <li><a href="../server_side/object_data.html">Reading table data from objects</a></li>
622 <li><a href="../server_side/row_details.html">Show and hide details about a particular record</a></li>
623 <li><a href="../server_side/select_rows.html">User selectable rows (multiple rows)</a></li>
624 <li><a href="../server_side/jsonp.html">JSONP for a cross domain data source</a></li>
625 <li><a href="../server_side/editable.html">jEditable integration with DataTables</a></li>
626 <li><a href="../server_side/defer_loading.html">Deferred loading of Ajax data</a></li>
627 <li><a href="../server_side/pipeline.html">Pipelining data (reduce Ajax calls for paging)</a></li>
630 <h2>Ajax data source</h2>
632 <li><a href="../ajax/ajax.html">Ajax sourced data (array of arrays)</a></li>
633 <li><a href="../ajax/objects.html">Ajax sourced data (array of objects)</a></li>
634 <li><a href="../ajax/defer_render.html">Deferred DOM creation for extra speed</a></li>
635 <li><a href="../ajax/null_data_source.html">Empty data source columns</a></li>
636 <li><a href="../ajax/custom_data_property.html">Use a data source other than aaData (the default)</a></li>
637 <li><a href="../ajax/objects_subarrays.html">Read column data from sub-arrays</a></li>
638 <li><a href="../ajax/deep.html">Read column data from deeply nested properties</a></li>
643 <li><a href="../plug-ins/plugin_api.html">Add custom API functions</a></li>
644 <li><a href="../plug-ins/sorting_plugin.html">Sorting and automatic type detection</a></li>
645 <li><a href="../plug-ins/sorting_sType.html">Sorting without automatic type detection</a></li>
646 <li><a href="../plug-ins/paging_plugin.html">Custom pagination controls</a></li>
647 <li><a href="../plug-ins/range_filtering.html">Range filtering / custom filtering</a></li>
648 <li><a href="../plug-ins/dom_sort.html">Live DOM sorting</a></li>
649 <li><a href="../plug-ins/html_sort.html">Automatic HTML type detection</a></li>
654 <div id="footer" class="clear" style="text-align:center;">
656 Please refer to the <a href="http://www.datatables.net/usage">DataTables documentation</a> for full information about its API properties and methods.<br>
657 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.
660 <span style="font-size:10px;">
661 DataTables designed and created by <a href="http://www.sprymedia.co.uk">Allan Jardine</a> © 2007-2011<br>
662 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>.