FixedHeader example - Multiple tables

The following example shows two DataTables enhanced tables both with FixedHeader enabled on them. This is done simply by initialising FixedHeader on each table. This example also shows the footer being fixed in place for the two tables.

Name Position Office Age Salary
Name Position Office Age Salary
Tiger Nixon System Architect Edinburgh 61 $3,120
Garrett Winters Director Edinburgh 63 $5,300
Cedric Kelly Javascript Developer Edinburgh 22 $3,600
Jenna Elliott Financial Controller Edinburgh 33 $5,300
Rhona Davidson Integration Specialist Edinburgh 55 $6,730
Sonya Frost Software Engineer Edinburgh 23 $3,600
Quinn Flynn Financial Controller Edinburgh 22 $4,200
Dai Rios System Architect Edinburgh 35 $4,200
Doris Wilder Sales Assistant Edinburgh 23 $4,965
Gavin Joyce Developer Edinburgh 42 $4,525
Russell Chavez Director Edinburgh 20 $3,600
Michelle House Integration Specialist Edinburgh 37 $3,750
Martena Mccray Integration Specialist Edinburgh 46 $4,080
Miriam Weiss Support Engineer Edinburgh 64 $4,965
Odessa Jackson Support Engineer Edinburgh 37 $3,600
Elton Baldwin Data Coordinator Edinburgh 64 $6,730
Jennifer Acosta Javascript Developer Edinburgh 43 $2,875
Shad Decker Regional Director Edinburgh 51 $5,300
Michael Bruce Javascript Developer Edinburgh 29 $4,080
Name Position Office Age Salary
Name Position Office Age Salary
Jena Gaines System Architect London 30 $5,000
Haley Kennedy Senior Marketing Designer London 43 $4,800
Tatyana Fitzpatrick Regional Director London 19 $2,875
Michael Silva Senior Marketing Designer London 66 $3,750
Bradley Greer Software Engineer London 41 $3,120
Angelica Ramos System Architect London 36 $2,875
Jennifer Chang Regional Director London 28 $4,080
Suki Burks Developer London 53 $2,875
Prescott Bartlett Technical Author London 27 $6,730
Timothy Mooney Financial Controller London 37 $4,200
Bruno Nash Software Engineer London 38 $4,200
Hermione Butler Director London 47 $4,080
Lael Greer Systems Administrator London 21 $3,120

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

$(document).ready(function() { var t1 = $('table.display').eq(0).DataTable(); new $.fn.dataTable.FixedHeader( t1, { bottom: true } ); var t2 = $('table.display').eq(1).DataTable(); new $.fn.dataTable.FixedHeader( t2, { bottom: true } ); } );

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

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:

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

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.