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 t.nixon@datatables.net
Garrett Winters Accountant Tokyo 63 8422 g.winters@datatables.net
Ashton Cox Junior Technical Author San Francisco 66 1562 a.cox@datatables.net
Cedric Kelly Senior Javascript Developer Edinburgh 22 6224 c.kelly@datatables.net
Airi Satou Accountant Tokyo 33 5407 a.satou@datatables.net
Brielle Williamson Integration Specialist New York 61 4804 b.williamson@datatables.net
Herrod Chandler Sales Assistant San Francisco 59 9608 h.chandler@datatables.net
Rhona Davidson Integration Specialist Tokyo 55 6200 r.davidson@datatables.net
Colleen Hurst Javascript Developer San Francisco 39 2360 c.hurst@datatables.net
Sonya Frost Software Engineer Edinburgh 23 1667 s.frost@datatables.net
Jena Gaines Office Manager London 30 3814 j.gaines@datatables.net
Quinn Flynn Support Lead Edinburgh 22 9497 q.flynn@datatables.net
Charde Marshall Regional Director San Francisco 36 6741 c.marshall@datatables.net
Haley Kennedy Senior Marketing Designer London 43 3597 h.kennedy@datatables.net
Tatyana Fitzpatrick Regional Director London 19 1965 t.fitzpatrick@datatables.net
Michael Silva Marketing Designer London 66 1581 m.silva@datatables.net
Paul Byrd Chief Financial Officer (CFO) New York 64 3059 p.byrd@datatables.net
Gloria Little Systems Administrator New York 59 1721 g.little@datatables.net
Bradley Greer Software Engineer London 41 2558 b.greer@datatables.net
Dai Rios Personnel Lead Edinburgh 35 2290 d.rios@datatables.net
Jenette Caldwell Development Lead New York 30 1937 j.caldwell@datatables.net
Yuri Berry Chief Marketing Officer (CMO) New York 40 6154 y.berry@datatables.net
Caesar Vance Pre-Sales Support New York 21 8330 c.vance@datatables.net
Doris Wilder Sales Assistant Sydney 23 3023 d.wilder@datatables.net
Angelica Ramos Chief Executive Officer (CEO) London 47 5797 a.ramos@datatables.net
Gavin Joyce Developer Edinburgh 42 8822 g.joyce@datatables.net
Jennifer Chang Regional Director Singapore 28 9239 j.chang@datatables.net
Brenden Wagner Software Engineer San Francisco 28 1314 b.wagner@datatables.net
Fiona Green Chief Operating Officer (COO) San Francisco 48 2947 f.green@datatables.net
Shou Itou Regional Marketing Tokyo 20 8899 s.itou@datatables.net
Michelle House Integration Specialist Sydney 37 2769 m.house@datatables.net
Suki Burks Developer London 53 6832 s.burks@datatables.net
Prescott Bartlett Technical Author London 27 3606 p.bartlett@datatables.net
Gavin Cortez Team Leader San Francisco 22 2860 g.cortez@datatables.net
Martena Mccray Post-Sales support Edinburgh 46 8240 m.mccray@datatables.net
Unity Butler Marketing Designer San Francisco 47 5384 u.butler@datatables.net
Howard Hatfield Office Manager San Francisco 51 7031 h.hatfield@datatables.net
Hope Fuentes Secretary San Francisco 41 6318 h.fuentes@datatables.net
Vivian Harrell Financial Controller San Francisco 62 9422 v.harrell@datatables.net
Timothy Mooney Office Manager London 37 7580 t.mooney@datatables.net
Jackson Bradshaw Director New York 65 1042 j.bradshaw@datatables.net
Olivia Liang Support Engineer Singapore 64 2120 o.liang@datatables.net
Bruno Nash Software Engineer London 38 6222 b.nash@datatables.net
Sakura Yamamoto Support Engineer Tokyo 37 9383 s.yamamoto@datatables.net
Thor Walton Developer New York 61 8327 t.walton@datatables.net
Finn Camacho Support Engineer San Francisco 47 2927 f.camacho@datatables.net
Serge Baldwin Data Coordinator Singapore 64 8352 s.baldwin@datatables.net
Zenaida Frank Software Engineer New York 63 7439 z.frank@datatables.net
Zorita Serrano Software Engineer San Francisco 56 4389 z.serrano@datatables.net
Jennifer Acosta Junior Javascript Developer Edinburgh 43 3431 j.acosta@datatables.net
Cara Stevens Sales Assistant New York 46 3990 c.stevens@datatables.net
Hermione Butler Regional Director London 47 1016 h.butler@datatables.net
Lael Greer Systems Administrator London 21 6733 l.greer@datatables.net
Jonas Alexander Developer San Francisco 30 8196 j.alexander@datatables.net
Shad Decker Regional Director Edinburgh 51 6373 s.decker@datatables.net
Michael Bruce Javascript Developer Singapore 29 5384 m.bruce@datatables.net
Donna Snider Customer Support New York 27 4226 d.snider@datatables.net
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