5 <link rel="shortcut icon" type="image/ico" href="http://www.datatables.net/favicon.ico">
6 <meta name="viewport" content="initial-scale=1.0, maximum-scale=2.0">
8 <title>FixedHeader example - Basic initialisation</title>
9 <link rel="stylesheet" type="text/css" href="../../../media/css/jquery.dataTables.css">
10 <link rel="stylesheet" type="text/css" href="../css/dataTables.fixedHeader.css">
11 <link rel="stylesheet" type="text/css" href="../../../examples/resources/syntax/shCore.css">
12 <link rel="stylesheet" type="text/css" href="../../../examples/resources/demo.css">
13 <style type="text/css" class="init">
16 <script type="text/javascript" language="javascript" src="../../../media/js/jquery.js"></script>
17 <script type="text/javascript" language="javascript" src="../../../media/js/jquery.dataTables.js"></script>
18 <script type="text/javascript" language="javascript" src="../js/dataTables.fixedHeader.js"></script>
19 <script type="text/javascript" language="javascript" src="../../../examples/resources/syntax/shCore.js"></script>
20 <script type="text/javascript" language="javascript" src="../../../examples/resources/demo.js"></script>
21 <script type="text/javascript" language="javascript" class="init">
24 $(document).ready(function() {
25 var table = $('#example').DataTable();
27 new $.fn.dataTable.FixedHeader( table );
34 <body class="dt-example">
35 <div class="container">
37 <h1>FixedHeader example <span>Basic initialisation</span></h1>
40 <p>When displaying large amounts of data in a table, it can often be useful for the end user to have
41 the column titles (the <code class="tag" title="HTML tag">thead</code> element as a whole in fact)
42 always visible. This is particularly true if using DataTables with pagination disabled, or the display
43 length is set to a high value.</p>
45 <p>The FixedHeader extension for DataTables will ensure that your column titles will scroll with the
46 page, showing at the top of the table at all times. Try the demo shown below - you might want to try
47 resizing the window for full effect! Note also that the column titles remain clickable to perform
48 sorting on the table.</p>
50 <p>FixedHeader is initialised using the constructor <code>new $.fn.dataTable.FixedHeader();</code> -
54 <table id="example" class="display" cellspacing="0" width="100%">
80 <td>System Architect</td>
87 <td>Garrett Winters</td>
96 <td>Junior Technical Author</td>
97 <td>San Francisco</td>
103 <td>Cedric Kelly</td>
104 <td>Senior Javascript Developer</td>
119 <td>Brielle Williamson</td>
120 <td>Integration Specialist</td>
127 <td>Herrod Chandler</td>
128 <td>Sales Assistant</td>
129 <td>San Francisco</td>
135 <td>Rhona Davidson</td>
136 <td>Integration Specialist</td>
143 <td>Colleen Hurst</td>
144 <td>Javascript Developer</td>
145 <td>San Francisco</td>
152 <td>Software Engineer</td>
160 <td>Office Manager</td>
168 <td>Support Lead</td>
175 <td>Charde Marshall</td>
176 <td>Regional Director</td>
177 <td>San Francisco</td>
183 <td>Haley Kennedy</td>
184 <td>Senior Marketing Designer</td>
191 <td>Tatyana Fitzpatrick</td>
192 <td>Regional Director</td>
199 <td>Michael Silva</td>
200 <td>Marketing Designer</td>
208 <td>Chief Financial Officer (CFO)</td>
215 <td>Gloria Little</td>
216 <td>Systems Administrator</td>
223 <td>Bradley Greer</td>
224 <td>Software Engineer</td>
232 <td>Personnel Lead</td>
239 <td>Jenette Caldwell</td>
240 <td>Development Lead</td>
248 <td>Chief Marketing Officer (CMO)</td>
255 <td>Caesar Vance</td>
256 <td>Pre-Sales Support</td>
263 <td>Doris Wilder</td>
264 <td>Sales Assistant</td>
271 <td>Angelica Ramos</td>
272 <td>Chief Executive Officer (CEO)</td>
287 <td>Jennifer Chang</td>
288 <td>Regional Director</td>
295 <td>Brenden Wagner</td>
296 <td>Software Engineer</td>
297 <td>San Francisco</td>
304 <td>Chief Operating Officer (COO)</td>
305 <td>San Francisco</td>
312 <td>Regional Marketing</td>
319 <td>Michelle House</td>
320 <td>Integration Specialist</td>
335 <td>Prescott Bartlett</td>
336 <td>Technical Author</td>
343 <td>Gavin Cortez</td>
345 <td>San Francisco</td>
351 <td>Martena Mccray</td>
352 <td>Post-Sales support</td>
359 <td>Unity Butler</td>
360 <td>Marketing Designer</td>
361 <td>San Francisco</td>
367 <td>Howard Hatfield</td>
368 <td>Office Manager</td>
369 <td>San Francisco</td>
375 <td>Hope Fuentes</td>
377 <td>San Francisco</td>
383 <td>Vivian Harrell</td>
384 <td>Financial Controller</td>
385 <td>San Francisco</td>
391 <td>Timothy Mooney</td>
392 <td>Office Manager</td>
399 <td>Jackson Bradshaw</td>
407 <td>Olivia Liang</td>
408 <td>Support Engineer</td>
416 <td>Software Engineer</td>
423 <td>Sakura Yamamoto</td>
424 <td>Support Engineer</td>
439 <td>Finn Camacho</td>
440 <td>Support Engineer</td>
441 <td>San Francisco</td>
447 <td>Serge Baldwin</td>
448 <td>Data Coordinator</td>
455 <td>Zenaida Frank</td>
456 <td>Software Engineer</td>
463 <td>Zorita Serrano</td>
464 <td>Software Engineer</td>
465 <td>San Francisco</td>
471 <td>Jennifer Acosta</td>
472 <td>Junior Javascript Developer</td>
479 <td>Cara Stevens</td>
480 <td>Sales Assistant</td>
487 <td>Hermione Butler</td>
488 <td>Regional Director</td>
496 <td>Systems Administrator</td>
503 <td>Jonas Alexander</td>
505 <td>San Francisco</td>
512 <td>Regional Director</td>
519 <td>Michael Bruce</td>
520 <td>Javascript Developer</td>
527 <td>Donna Snider</td>
528 <td>Customer Support</td>
538 <li class="active">Javascript</li>
542 <li>Server-side script</li>
547 <p>The Javascript shown below is used to initialise the table shown in this
548 example:</p><code class="multiline brush: js;">$(document).ready(function() {
549 var table = $('#example').DataTable();
551 new $.fn.dataTable.FixedHeader( table );
554 <p>In addition to the above code, the following Javascript library files are loaded for use in this
558 <li><a href="../../../media/js/jquery.js">../../../media/js/jquery.js</a></li>
560 "../../../media/js/jquery.dataTables.js">../../../media/js/jquery.dataTables.js</a></li>
561 <li><a href="../js/dataTables.fixedHeader.js">../js/dataTables.fixedHeader.js</a></li>
566 <p>The HTML shown below is the raw HTML table element, before it has been enhanced by
572 <p>This example uses a little bit of additional CSS beyond what is loaded from the library
573 files (below), in order to correctly display the table. The additional CSS used is shown
574 below:</p><code class="multiline brush: js;"></code>
577 <p>The following CSS library files are loaded for use in this example to provide the styling of the
582 "../../../media/css/jquery.dataTables.css">../../../media/css/jquery.dataTables.css</a></li>
583 <li><a href="../css/dataTables.fixedHeader.css">../css/dataTables.fixedHeader.css</a></li>
588 <p>This table loads data by Ajax. The latest data that has been loaded is shown below. This data
589 will update automatically as any additional data is loaded.</p>
593 <p>The script used to perform the server-side processing for this table is shown below. Please note
594 that this is just an example script using PHP. Server-side processing scripts can be written in any
595 language, using <a href="//datatables.net/manual/server-side">the protocol described in the
596 DataTables documentation</a>.</p>
604 <div class="gradient"></div>
607 <h2>Other examples</h2>
610 <div class="toc-group">
611 <h3><a href="./index.html">Examples</a></h3>
612 <ul class="toc active">
613 <li class="active"><a href="./simple.html">Basic initialisation</a></li>
614 <li><a href="./header_footer.html">Header and footer fixed</a></li>
615 <li><a href="./top_left_right.html">Header, left and right all fixed</a></li>
616 <li><a href="./two_tables.html">Multiple tables</a></li>
617 <li><a href="./zIndexes.html">z-index order control</a></li>
622 <div class="epilogue">
623 <p>Please refer to the <a href="http://www.datatables.net">DataTables documentation</a> for full
624 information about its API properties and methods.<br>
625 Additionally, there are a wide range of <a href="http://www.datatables.net/extras">extras</a> and
626 <a href="http://www.datatables.net/plug-ins">plug-ins</a> which extend the capabilities of
629 <p class="copyright">DataTables designed and created by <a href=
630 "http://www.sprymedia.co.uk">SpryMedia Ltd</a> © 2007-2014<br>
631 DataTables is licensed under the <a href="http://www.datatables.net/mit">MIT license</a>.</p>