# FixedColumns example - Complex headers

If you are using multiple rows in the table header, it can be useful to have a rowspanning cell on the column(s) you have fixed in place - equally at other times it can be useful to not and make use of the two or more cells per column. FixedColumns builds on the complex header support in DataTables to make this trivial to use in FixedColumns. Just initialise your FixedColumns instance as you normally would!

Name | HR Information | Contact
--- | --- | ---
Position | Salary | Office | Extn. | E-mail
Name | Position | Salary | Office | Extn. | E-mail
Tiger Nixon | System Architect | $3,120 | Edinburgh | 5421 | t.nixon@datatables.net
Garrett Winters | Director | $5,300 | Edinburgh | 8422 | g.winters@datatables.net
Ashton Cox | Technical Author | $4,800 | San Francisco | 1562 | a.cox@datatables.net
Cedric Kelly | Javascript Developer | $3,600 | Edinburgh | 6224 | c.kelly@datatables.net
Jenna Elliott | Financial Controller | $5,300 | Edinburgh | 5407 | j.elliott@datatables.net
Brielle Williamson | Integration Specialist | $4,525 | New York | 4804 | b.williamson@datatables.net
Herrod Chandler | Sales Assistant | $4,080 | San Francisco | 9608 | h.chandler@datatables.net
Rhona Davidson | Integration Specialist | $6,730 | Edinburgh | 6200 | r.davidson@datatables.net
Colleen Hurst | Javascript Developer | $5,000 | San Francisco | 2360 | c.hurst@datatables.net
Sonya Frost | Software Engineer | $3,600 | Edinburgh | 1667 | s.frost@datatables.net
Jena Gaines | System Architect | $5,000 | London | 3814 | j.gaines@datatables.net
Quinn Flynn | Financial Controller | $4,200 | Edinburgh | 9497 | q.flynn@datatables.net
Charde Marshall | Regional Director | $5,300 | San Francisco | 6741 | c.marshall@datatables.net
Haley Kennedy | Senior Marketing Designer | $4,800 | London | 3597 | h.kennedy@datatables.net
Tatyana Fitzpatrick | Regional Director | $2,875 | London | 1965 | t.fitzpatrick@datatables.net
Michael Silva | Senior Marketing Designer | $3,750 | London | 1581 | m.silva@datatables.net
Paul Byrd | Javascript Developer | $5,000 | New York | 3059 | p.byrd@datatables.net
Gloria Little | Systems Administrator | $3,120 | New York | 1721 | g.little@datatables.net
Bradley Greer | Software Engineer | $3,120 | London | 2558 | b.greer@datatables.net
Dai Rios | System Architect | $4,200 | Edinburgh | 2290 | d.rios@datatables.net
Jenette Caldwell | Financial Controller | $4,965 | New York | 1937 | j.caldwell@datatables.net
Yuri Berry | System Architect | $3,600 | New York | 6154 | y.berry@datatables.net
Caesar Vance | Technical Author | $4,965 | New York | 8330 | c.vance@datatables.net
Doris Wilder | Sales Assistant | $4,965 | Edinburgh | 3023 | d.wilder@datatables.net
Angelica Ramos | System Architect | $2,875 | London | 5797 | a.ramos@datatables.net
Gavin Joyce | Developer | $4,525 | Edinburgh | 8822 | g.joyce@datatables.net
Jennifer Chang | Regional Director | $4,080 | London | 9239 | j.chang@datatables.net
Brenden Wagner | Software Engineer | $3,750 | San Francisco | 1314 | b.wagner@datatables.net
Ebony Grimes | Software Engineer | $2,875 | San Francisco | 2947 | e.grimes@datatables.net
Russell Chavez | Director | $3,600 | Edinburgh | 8899 | r.chavez@datatables.net
Michelle House | Integration Specialist | $3,750 | Edinburgh | 2769 | m.house@datatables.net
Suki Burks | Developer | $2,875 | London | 6832 | s.burks@datatables.net
Prescott Bartlett | Technical Author | $6,730 | London | 3606 | p.bartlett@datatables.net
Gavin Cortez | Technical Author | $6,730 | San Francisco | 2860 | g.cortez@datatables.net
Martena Mccray | Integration Specialist | $4,080 | Edinburgh | 8240 | m.mccray@datatables.net
Unity Butler | Senior Marketing Designer | $3,750 | San Francisco | 5384 | u.butler@datatables.net
Howard Hatfield | Financial Controller | $4,080 | San Francisco | 7031 | h.hatfield@datatables.net
Hope Fuentes | Financial Controller | $4,200 | San Francisco | 6318 | h.fuentes@datatables.net
Vivian Harrell | System Architect | $4,965 | San Francisco | 9422 | v.harrell@datatables.net
Timothy Mooney | Financial Controller | $4,200 | London | 7580 | t.mooney@datatables.net
Jackson Bradshaw | Director | $5,000 | New York | 1042 | j.bradshaw@datatables.net
Miriam Weiss | Support Engineer | $4,965 | Edinburgh | 2120 | m.weiss@datatables.net
Bruno Nash | Software Engineer | $4,200 | London | 6222 | b.nash@datatables.net
Odessa Jackson | Support Engineer | $3,600 | Edinburgh | 9383 | o.jackson@datatables.net
Thor Walton | Developer | $3,600 | New York | 8327 | t.walton@datatables.net
Finn Camacho | Support Engineer | $4,800 | San Francisco | 2927 | f.camacho@datatables.net
Elton Baldwin | Data Coordinator | $6,730 | Edinburgh | 8352 | e.baldwin@datatables.net
Zenaida Frank | Software Engineer | $4,800 | New York | 7439 | z.frank@datatables.net
Zorita Serrano | Software Engineer | $5,300 | San Francisco | 4389 | z.serrano@datatables.net
Jennifer Acosta | Javascript Developer | $2,875 | Edinburgh | 3431 | j.acosta@datatables.net
Cara Stevens | Sales Assistant | $4,800 | New York | 3990 | c.stevens@datatables.net
Hermione Butler | Director | $4,080 | London | 1016 | h.butler@datatables.net
Lael Greer | Systems Administrator | $3,120 | London | 6733 | l.greer@datatables.net
Jonas Alexander | Developer | $5,300 | San Francisco | 8196 | j.alexander@datatables.net
Shad Decker | Regional Director | $5,300 | Edinburgh | 6373 | s.decker@datatables.net
Michael Bruce | Javascript Developer | $4,080 | Edinburgh | 5384 | m.bruce@datatables.net
Donna Snider | System Architect | $3,120 | New York | 4226 | d.snider@datatables.net

- Javascript
- HTML
- CSS
- Ajax
- Server-side script

The Javascript shown below is used to initialise the table shown in this example:

`$(document).ready(function() { var table = $('#example').DataTable( { scrollY: "300px", scrollX: true, scrollCollapse: true, paging: false } ); new $.fn.dataTable.FixedColumns( table ); } );`

In addition to the above code, the following Javascript library files are loaded for use in this example:

- ../../../media/js/jquery.js
- ../../../media/js/jquery.dataTables.js
- ../js/dataTables.fixedColumns.js

The HTML shown below is the raw HTML table element, before it has been enhanced by DataTables:

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 additional CSS used is shown below:

`/* Ensure that the demo table scrolls */ th, td { white-space: nowrap; padding-left: 40px !important; padding-right: 40px !important; } div.dataTables_wrapper { width: 800px; margin: 0 auto; }`

The following CSS library files are loaded for use in this example to provide the styling of the table:

- ../../../media/css/jquery.dataTables.css
- ../css/dataTables.fixedColumns.css

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 loaded.

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 processing scripts can be written in any language, using the protocol described in the DataTables documentation.