Complex headers

This example demonstrates the use of ColReorder with complex headers (i.e. multi-row headers and / or colspan/ rowspan attributes on the header's cells).

Name HR Contact
First name Last name Position Office Age Extn. E-mail
Tiger Nixon System Architect Edinburgh 61 5421
Garrett Winters Accountant Tokyo 63 8422
Ashton Cox Junior Technical Author San Francisco 66 1562
Cedric Kelly Senior Javascript Developer Edinburgh 22 6224
Airi Satou Accountant Tokyo 33 5407
Brielle Williamson Integration Specialist New York 61 4804
Herrod Chandler Sales Assistant San Francisco 59 9608
Rhona Davidson Integration Specialist Tokyo 55 6200
Colleen Hurst Javascript Developer San Francisco 39 2360
Sonya Frost Software Engineer Edinburgh 23 1667
Jena Gaines Office Manager London 30 3814
Quinn Flynn Support Lead Edinburgh 22 9497
Charde Marshall Regional Director San Francisco 36 6741
Haley Kennedy Senior Marketing Designer London 43 3597
Tatyana Fitzpatrick Regional Director London 19 1965
Michael Silva Marketing Designer London 66 1581
Paul Byrd Chief Financial Officer (CFO) New York 64 3059
Gloria Little Systems Administrator New York 59 1721
Bradley Greer Software Engineer London 41 2558
Dai Rios Personnel Lead Edinburgh 35 2290
Jenette Caldwell Development Lead New York 30 1937
Yuri Berry Chief Marketing Officer (CMO) New York 40 6154
Caesar Vance Pre-Sales Support New York 21 8330
Doris Wilder Sales Assistant Sydney 23 3023
Angelica Ramos Chief Executive Officer (CEO) London 47 5797
Gavin Joyce Developer Edinburgh 42 8822
Jennifer Chang Regional Director Singapore 28 9239
Brenden Wagner Software Engineer San Francisco 28 1314
Fiona Green Chief Operating Officer (COO) San Francisco 48 2947
Shou Itou Regional Marketing Tokyo 20 8899
Michelle House Integration Specialist Sydney 37 2769
Suki Burks Developer London 53 6832
Prescott Bartlett Technical Author London 27 3606
Gavin Cortez Team Leader San Francisco 22 2860
Martena Mccray Post-Sales support Edinburgh 46 8240
Unity Butler Marketing Designer San Francisco 47 5384
Howard Hatfield Office Manager San Francisco 51 7031
Hope Fuentes Secretary San Francisco 41 6318
Vivian Harrell Financial Controller San Francisco 62 9422
Timothy Mooney Office Manager London 37 7580
Jackson Bradshaw Director New York 65 1042
Olivia Liang Support Engineer Singapore 64 2120
Bruno Nash Software Engineer London 38 6222
Sakura Yamamoto Support Engineer Tokyo 37 9383
Thor Walton Developer New York 61 8327
Finn Camacho Support Engineer San Francisco 47 2927
Serge Baldwin Data Coordinator Singapore 64 8352
Zenaida Frank Software Engineer New York 63 7439
Zorita Serrano Software Engineer San Francisco 56 4389
Jennifer Acosta Junior Javascript Developer Edinburgh 43 3431
Cara Stevens Sales Assistant New York 46 3990
Hermione Butler Regional Director London 47 1016
Lael Greer Systems Administrator London 21 6733
Jonas Alexander Developer San Francisco 30 8196
Shad Decker Regional Director Edinburgh 51 6373
Michael Bruce Javascript Developer Singapore 29 5384
Donna Snider Customer Support New York 27 4226
First name Last name Position Office Age Extn. E-mail
  • Javascript
  • HTML
  • CSS
  • Ajax
  • Server-side script
  • Comments

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

$('#example').DataTable({ colReorder: true });
new DataTable('#example', { colReorder: 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.

      Other examples