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>FixedColumns example - CSS row sizing</title>
9 <link rel="stylesheet" type="text/css" href="../../../media/css/jquery.dataTables.css">
10 <link rel="stylesheet" type="text/css" href="../css/dataTables.fixedColumns.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">
15 /* Ensure that the demo table scrolls */
16 th, td { white-space: nowrap; }
17 div.dataTables_wrapper {
25 <script type="text/javascript" language="javascript" src="../../../media/js/jquery.js"></script>
26 <script type="text/javascript" language="javascript" src="../../../media/js/jquery.dataTables.js"></script>
27 <script type="text/javascript" language="javascript" src="../js/dataTables.fixedColumns.js"></script>
28 <script type="text/javascript" language="javascript" src="../../../examples/resources/syntax/shCore.js"></script>
29 <script type="text/javascript" language="javascript" src="../../../examples/resources/demo.js"></script>
30 <script type="text/javascript" language="javascript" class="init">
33 $(document).ready(function() {
34 var table = $('#example').DataTable( {
41 new $.fn.dataTable.FixedColumns( table, {
50 <body class="dt-example">
51 <div class="container">
53 <h1>FixedColumns example <span>CSS row sizing</span></h1>
56 <p>Because of the method FixedColumns uses to display the fixed columns, an important consideration is the alignment of the rows due to different heights in the
57 individual rows of the table. There are two different algorithms in FixedColumns which can be used, or you can switch off automatic row sizing all together. This
58 is controlled through the <code>heightMatch</code> parameter. If can take the following values:</p>
61 <li><code class="string" title="String">none</code> - no automatic row height matching is performed. CSS can be used in this case and is useful when speed is
62 of primary importance.</li>
63 <li><code class="string" title="String">semiauto</code> (default) - the height calculation will be performed once, and the result cached to be used again
64 (<code>fnRecalculateHeight</code> can be used to force recalculation)</li>
65 <li><code class="string" title="String">auto</code> - height matching is performed on every draw (slowest but must accurate)</li>
68 <p>This example shows row height matching switched off but there is a CSS statement of <code>tr { height: 50px }</code> to force all rows to the same height.</p>
71 <table id="example" class="stripe row-border order-column" cellspacing="0" width="100%">
90 <td>System Architect</td>
96 <td>t.nixon@datatables.net</td>
107 <td>g.winters@datatables.net</td>
112 <td>Junior Technical Author</td>
113 <td>San Francisco</td>
118 <td>a.cox@datatables.net</td>
123 <td>Senior Javascript Developer</td>
129 <td>c.kelly@datatables.net</td>
140 <td>a.satou@datatables.net</td>
145 <td>Integration Specialist</td>
151 <td>b.williamson@datatables.net</td>
156 <td>Sales Assistant</td>
157 <td>San Francisco</td>
162 <td>h.chandler@datatables.net</td>
167 <td>Integration Specialist</td>
173 <td>r.davidson@datatables.net</td>
178 <td>Javascript Developer</td>
179 <td>San Francisco</td>
184 <td>c.hurst@datatables.net</td>
189 <td>Software Engineer</td>
195 <td>s.frost@datatables.net</td>
200 <td>Office Manager</td>
206 <td>j.gaines@datatables.net</td>
211 <td>Support Lead</td>
217 <td>q.flynn@datatables.net</td>
222 <td>Regional Director</td>
223 <td>San Francisco</td>
228 <td>c.marshall@datatables.net</td>
233 <td>Senior Marketing Designer</td>
239 <td>h.kennedy@datatables.net</td>
244 <td>Regional Director</td>
250 <td>t.fitzpatrick@datatables.net</td>
255 <td>Marketing Designer</td>
261 <td>m.silva@datatables.net</td>
266 <td>Chief Financial Officer (CFO)</td>
272 <td>p.byrd@datatables.net</td>
277 <td>Systems Administrator</td>
283 <td>g.little@datatables.net</td>
288 <td>Software Engineer</td>
294 <td>b.greer@datatables.net</td>
299 <td>Personnel Lead</td>
305 <td>d.rios@datatables.net</td>
310 <td>Development Lead</td>
316 <td>j.caldwell@datatables.net</td>
321 <td>Chief Marketing Officer (CMO)</td>
327 <td>y.berry@datatables.net</td>
332 <td>Pre-Sales Support</td>
338 <td>c.vance@datatables.net</td>
343 <td>Sales Assistant</td>
349 <td>d.wilder@datatables.net</td>
354 <td>Chief Executive Officer (CEO)</td>
360 <td>a.ramos@datatables.net</td>
371 <td>g.joyce@datatables.net</td>
376 <td>Regional Director</td>
382 <td>j.chang@datatables.net</td>
387 <td>Software Engineer</td>
388 <td>San Francisco</td>
393 <td>b.wagner@datatables.net</td>
398 <td>Chief Operating Officer (COO)</td>
399 <td>San Francisco</td>
404 <td>f.green@datatables.net</td>
409 <td>Regional Marketing</td>
415 <td>s.itou@datatables.net</td>
420 <td>Integration Specialist</td>
426 <td>m.house@datatables.net</td>
437 <td>s.burks@datatables.net</td>
442 <td>Technical Author</td>
448 <td>p.bartlett@datatables.net</td>
454 <td>San Francisco</td>
459 <td>g.cortez@datatables.net</td>
464 <td>Post-Sales support</td>
470 <td>m.mccray@datatables.net</td>
475 <td>Marketing Designer</td>
476 <td>San Francisco</td>
481 <td>u.butler@datatables.net</td>
486 <td>Office Manager</td>
487 <td>San Francisco</td>
492 <td>h.hatfield@datatables.net</td>
498 <td>San Francisco</td>
503 <td>h.fuentes@datatables.net</td>
508 <td>Financial Controller</td>
509 <td>San Francisco</td>
514 <td>v.harrell@datatables.net</td>
519 <td>Office Manager</td>
525 <td>t.mooney@datatables.net</td>
536 <td>j.bradshaw@datatables.net</td>
541 <td>Support Engineer</td>
547 <td>o.liang@datatables.net</td>
552 <td>Software Engineer</td>
558 <td>b.nash@datatables.net</td>
563 <td>Support Engineer</td>
569 <td>s.yamamoto@datatables.net</td>
580 <td>t.walton@datatables.net</td>
585 <td>Support Engineer</td>
586 <td>San Francisco</td>
591 <td>f.camacho@datatables.net</td>
596 <td>Data Coordinator</td>
602 <td>s.baldwin@datatables.net</td>
607 <td>Software Engineer</td>
613 <td>z.frank@datatables.net</td>
618 <td>Software Engineer</td>
619 <td>San Francisco</td>
624 <td>z.serrano@datatables.net</td>
629 <td>Junior Javascript Developer</td>
635 <td>j.acosta@datatables.net</td>
640 <td>Sales Assistant</td>
646 <td>c.stevens@datatables.net</td>
651 <td>Regional Director</td>
657 <td>h.butler@datatables.net</td>
662 <td>Systems Administrator</td>
668 <td>l.greer@datatables.net</td>
674 <td>San Francisco</td>
679 <td>j.alexander@datatables.net</td>
684 <td>Regional Director</td>
690 <td>s.decker@datatables.net</td>
695 <td>Javascript Developer</td>
701 <td>m.bruce@datatables.net</td>
706 <td>Customer Support</td>
712 <td>d.snider@datatables.net</td>
718 <li class="active">Javascript</li>
722 <li>Server-side script</li>
727 <p>The Javascript shown below is used to initialise the table shown in this example:</p><code class="multiline language-js">$(document).ready(function() {
728 var table = $('#example').DataTable( {
729 scrollY: "300px",
731 scrollCollapse: true,
735 new $.fn.dataTable.FixedColumns( table, {
740 <p>In addition to the above code, the following Javascript library files are loaded for use in this example:</p>
743 <li><a href="../../../media/js/jquery.js">../../../media/js/jquery.js</a></li>
744 <li><a href="../../../media/js/jquery.dataTables.js">../../../media/js/jquery.dataTables.js</a></li>
745 <li><a href="../js/dataTables.fixedColumns.js">../js/dataTables.fixedColumns.js</a></li>
750 <p>The HTML shown below is the raw HTML table element, before it has been enhanced by DataTables:</p>
755 <p>This example uses a little bit of additional CSS beyond what is loaded from the library files (below), in order to correctly display the table. The
756 additional CSS used is shown below:</p><code class="multiline language-css">/* Ensure that the demo table scrolls */
757 th, td { white-space: nowrap; }
758 div.dataTables_wrapper {
763 tr { height: 50px; }</code>
766 <p>The following CSS library files are loaded for use in this example to provide the styling of the table:</p>
769 <li><a href="../../../media/css/jquery.dataTables.css">../../../media/css/jquery.dataTables.css</a></li>
770 <li><a href="../css/dataTables.fixedColumns.css">../css/dataTables.fixedColumns.css</a></li>
775 <p>This table loads data by Ajax. The latest data that has been loaded is shown below. This data will update automatically as any additional data is
780 <p>The script used to perform the server-side processing for this table is shown below. Please note that this is just an example script using PHP. Server-side
781 processing scripts can be written in any language, using <a href="//datatables.net/manual/server-side">the protocol described in the DataTables
782 documentation</a>.</p>
790 <div class="gradient"></div>
793 <h2>Other examples</h2>
796 <div class="toc-group">
797 <h3><a href="./index.html">Examples</a></h3>
798 <ul class="toc active">
799 <li><a href="./left_right_columns.html">Left and right fixed columns</a></li>
800 <li><a href="./simple.html">Basic initialisation</a></li>
801 <li><a href="./two_columns.html">Multiple fixed columns</a></li>
802 <li><a href="./right_column.html">Right column only</a></li>
803 <li><a href="./rowspan.html">Complex headers</a></li>
804 <li><a href="./colvis.html">ColVis integration</a></li>
805 <li><a href="./server-side-processing.html">Server-side processing</a></li>
806 <li class="active"><a href="./css_size.html">CSS row sizing</a></li>
807 <li><a href="./size_fixed.html">Assigned column width</a></li>
808 <li><a href="./size_fluid.html">Fluid column width</a></li>
809 <li><a href="./col_filter.html">Individual column filtering</a></li>
810 <li><a href="./bootstrap.html">Bootstrap</a></li>
811 <li><a href="./index_column.html">Index column</a></li>
816 <div class="epilogue">
817 <p>Please refer to the <a href="http://www.datatables.net">DataTables documentation</a> for full information about its API properties and methods.<br>
818 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>
819 which extend the capabilities of DataTables.</p>
821 <p class="copyright">DataTables designed and created by <a href="http://www.sprymedia.co.uk">SpryMedia Ltd</a> © 2007-2015<br>
822 DataTables is licensed under the <a href="http://www.datatables.net/mit">MIT license</a>.</p>