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 - Index column</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 {
22 /* Styling for the index columns */
25 background-color: white !important;
26 border-top: 1px solid white !important;
27 border-bottom: none !important;
29 div.DTFC_LeftHeadWrapper table {
30 border-bottom: 1px solid white !important;
32 div.DTFC_LeftHeadWrapper th {
33 border-bottom: 1px solid white !important;
35 div.DTFC_LeftBodyWrapper {
36 border-right: 1px solid black;
38 div.DTFC_LeftFootWrapper th {
39 border-top: 1px solid white !important;
43 <script type="text/javascript" language="javascript" src="../../../media/js/jquery.js"></script>
44 <script type="text/javascript" language="javascript" src="../../../media/js/jquery.dataTables.js"></script>
45 <script type="text/javascript" language="javascript" src="../js/dataTables.fixedColumns.js"></script>
46 <script type="text/javascript" language="javascript" src="../../../examples/resources/syntax/shCore.js"></script>
47 <script type="text/javascript" language="javascript" src="../../../examples/resources/demo.js"></script>
48 <script type="text/javascript" language="javascript" class="init">
51 $(document).ready(function() {
52 var table = $('#example').DataTable( {
65 table.on( 'order.dt search.dt', function () {
66 table.column(0, {search:'applied', order:'applied'}).nodes().each( function (cell, i) {
71 new $.fn.dataTable.FixedColumns( table );
78 <body class="dt-example">
79 <div class="container">
81 <h1>FixedColumns example <span>Index column</span></h1>
84 <p>A typical interaction to want to perform with a fixed column, is an index column. A method for how this can be achieved with FixedColumns is shown in this
85 example, building on the <a href="http://datatables.net/examples/api/counter_column">index column</a> example for DataTables. Also shown in this example is how the
86 fixed column can be styled with CSS to show it more prominently.</p>
89 <table id="example" class="stripe row-border order-column" cellspacing="0" width="100%">
110 <td>System Architect</td>
116 <td>t.nixon@datatables.net</td>
128 <td>g.winters@datatables.net</td>
134 <td>Junior Technical Author</td>
135 <td>San Francisco</td>
140 <td>a.cox@datatables.net</td>
146 <td>Senior Javascript Developer</td>
152 <td>c.kelly@datatables.net</td>
164 <td>a.satou@datatables.net</td>
170 <td>Integration Specialist</td>
176 <td>b.williamson@datatables.net</td>
182 <td>Sales Assistant</td>
183 <td>San Francisco</td>
188 <td>h.chandler@datatables.net</td>
194 <td>Integration Specialist</td>
200 <td>r.davidson@datatables.net</td>
206 <td>Javascript Developer</td>
207 <td>San Francisco</td>
212 <td>c.hurst@datatables.net</td>
218 <td>Software Engineer</td>
224 <td>s.frost@datatables.net</td>
230 <td>Office Manager</td>
236 <td>j.gaines@datatables.net</td>
242 <td>Support Lead</td>
248 <td>q.flynn@datatables.net</td>
254 <td>Regional Director</td>
255 <td>San Francisco</td>
260 <td>c.marshall@datatables.net</td>
266 <td>Senior Marketing Designer</td>
272 <td>h.kennedy@datatables.net</td>
278 <td>Regional Director</td>
284 <td>t.fitzpatrick@datatables.net</td>
290 <td>Marketing Designer</td>
296 <td>m.silva@datatables.net</td>
302 <td>Chief Financial Officer (CFO)</td>
308 <td>p.byrd@datatables.net</td>
314 <td>Systems Administrator</td>
320 <td>g.little@datatables.net</td>
326 <td>Software Engineer</td>
332 <td>b.greer@datatables.net</td>
338 <td>Personnel Lead</td>
344 <td>d.rios@datatables.net</td>
350 <td>Development Lead</td>
356 <td>j.caldwell@datatables.net</td>
362 <td>Chief Marketing Officer (CMO)</td>
368 <td>y.berry@datatables.net</td>
374 <td>Pre-Sales Support</td>
380 <td>c.vance@datatables.net</td>
386 <td>Sales Assistant</td>
392 <td>d.wilder@datatables.net</td>
398 <td>Chief Executive Officer (CEO)</td>
404 <td>a.ramos@datatables.net</td>
416 <td>g.joyce@datatables.net</td>
422 <td>Regional Director</td>
428 <td>j.chang@datatables.net</td>
434 <td>Software Engineer</td>
435 <td>San Francisco</td>
440 <td>b.wagner@datatables.net</td>
446 <td>Chief Operating Officer (COO)</td>
447 <td>San Francisco</td>
452 <td>f.green@datatables.net</td>
458 <td>Regional Marketing</td>
464 <td>s.itou@datatables.net</td>
470 <td>Integration Specialist</td>
476 <td>m.house@datatables.net</td>
488 <td>s.burks@datatables.net</td>
494 <td>Technical Author</td>
500 <td>p.bartlett@datatables.net</td>
507 <td>San Francisco</td>
512 <td>g.cortez@datatables.net</td>
518 <td>Post-Sales support</td>
524 <td>m.mccray@datatables.net</td>
530 <td>Marketing Designer</td>
531 <td>San Francisco</td>
536 <td>u.butler@datatables.net</td>
542 <td>Office Manager</td>
543 <td>San Francisco</td>
548 <td>h.hatfield@datatables.net</td>
555 <td>San Francisco</td>
560 <td>h.fuentes@datatables.net</td>
566 <td>Financial Controller</td>
567 <td>San Francisco</td>
572 <td>v.harrell@datatables.net</td>
578 <td>Office Manager</td>
584 <td>t.mooney@datatables.net</td>
596 <td>j.bradshaw@datatables.net</td>
602 <td>Support Engineer</td>
608 <td>o.liang@datatables.net</td>
614 <td>Software Engineer</td>
620 <td>b.nash@datatables.net</td>
626 <td>Support Engineer</td>
632 <td>s.yamamoto@datatables.net</td>
644 <td>t.walton@datatables.net</td>
650 <td>Support Engineer</td>
651 <td>San Francisco</td>
656 <td>f.camacho@datatables.net</td>
662 <td>Data Coordinator</td>
668 <td>s.baldwin@datatables.net</td>
674 <td>Software Engineer</td>
680 <td>z.frank@datatables.net</td>
686 <td>Software Engineer</td>
687 <td>San Francisco</td>
692 <td>z.serrano@datatables.net</td>
698 <td>Junior Javascript Developer</td>
704 <td>j.acosta@datatables.net</td>
710 <td>Sales Assistant</td>
716 <td>c.stevens@datatables.net</td>
722 <td>Regional Director</td>
728 <td>h.butler@datatables.net</td>
734 <td>Systems Administrator</td>
740 <td>l.greer@datatables.net</td>
747 <td>San Francisco</td>
752 <td>j.alexander@datatables.net</td>
758 <td>Regional Director</td>
764 <td>s.decker@datatables.net</td>
770 <td>Javascript Developer</td>
776 <td>m.bruce@datatables.net</td>
782 <td>Customer Support</td>
788 <td>d.snider@datatables.net</td>
794 <li class="active">Javascript</li>
798 <li>Server-side script</li>
803 <p>The Javascript shown below is used to initialise the table shown in this example:</p><code class="multiline language-js">$(document).ready(function() {
804 var table = $('#example').DataTable( {
805 scrollY: "300px",
807 scrollCollapse: true,
811 "class": "index",
814 order: [[ 1, 'asc' ]]
817 table.on( 'order.dt search.dt', function () {
818 table.column(0, {search:'applied', order:'applied'}).nodes().each( function (cell, i) {
819 cell.innerHTML = i+1;
823 new $.fn.dataTable.FixedColumns( table );
826 <p>In addition to the above code, the following Javascript library files are loaded for use in this example:</p>
829 <li><a href="../../../media/js/jquery.js">../../../media/js/jquery.js</a></li>
830 <li><a href="../../../media/js/jquery.dataTables.js">../../../media/js/jquery.dataTables.js</a></li>
831 <li><a href="../js/dataTables.fixedColumns.js">../js/dataTables.fixedColumns.js</a></li>
836 <p>The HTML shown below is the raw HTML table element, before it has been enhanced by DataTables:</p>
841 <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
842 additional CSS used is shown below:</p><code class="multiline language-css">/* Ensure that the demo table scrolls */
843 th, td { white-space: nowrap; }
844 div.dataTables_wrapper {
849 /* Styling for the index columns */
852 background-color: white !important;
853 border-top: 1px solid white !important;
854 border-bottom: none !important;
856 div.DTFC_LeftHeadWrapper table {
857 border-bottom: 1px solid white !important;
859 div.DTFC_LeftHeadWrapper th {
860 border-bottom: 1px solid white !important;
862 div.DTFC_LeftBodyWrapper {
863 border-right: 1px solid black;
865 div.DTFC_LeftFootWrapper th {
866 border-top: 1px solid white !important;
870 <p>The following CSS library files are loaded for use in this example to provide the styling of the table:</p>
873 <li><a href="../../../media/css/jquery.dataTables.css">../../../media/css/jquery.dataTables.css</a></li>
874 <li><a href="../css/dataTables.fixedColumns.css">../css/dataTables.fixedColumns.css</a></li>
879 <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
884 <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
885 processing scripts can be written in any language, using <a href="//datatables.net/manual/server-side">the protocol described in the DataTables
886 documentation</a>.</p>
894 <div class="gradient"></div>
897 <h2>Other examples</h2>
900 <div class="toc-group">
901 <h3><a href="./index.html">Examples</a></h3>
902 <ul class="toc active">
903 <li><a href="./left_right_columns.html">Left and right fixed columns</a></li>
904 <li><a href="./simple.html">Basic initialisation</a></li>
905 <li><a href="./two_columns.html">Multiple fixed columns</a></li>
906 <li><a href="./right_column.html">Right column only</a></li>
907 <li><a href="./rowspan.html">Complex headers</a></li>
908 <li><a href="./colvis.html">ColVis integration</a></li>
909 <li><a href="./server-side-processing.html">Server-side processing</a></li>
910 <li><a href="./css_size.html">CSS row sizing</a></li>
911 <li><a href="./size_fixed.html">Assigned column width</a></li>
912 <li><a href="./size_fluid.html">Fluid column width</a></li>
913 <li><a href="./col_filter.html">Individual column filtering</a></li>
914 <li><a href="./bootstrap.html">Bootstrap</a></li>
915 <li class="active"><a href="./index_column.html">Index column</a></li>
920 <div class="epilogue">
921 <p>Please refer to the <a href="http://www.datatables.net">DataTables documentation</a> for full information about its API properties and methods.<br>
922 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>
923 which extend the capabilities of DataTables.</p>
925 <p class="copyright">DataTables designed and created by <a href="http://www.sprymedia.co.uk">SpryMedia Ltd</a> © 2007-2015<br>
926 DataTables is licensed under the <a href="http://www.datatables.net/mit">MIT license</a>.</p>