ColReorder example Predefined column ordering

ColReorder provides the ability to specify a column ordering which is not that of the HTML (which typically you will want) through the parameter colReorder.order. This is an array of integers with the column ordering you want.

Start dateAgeOfficePositionNameSalary
Start dateAgeOfficePositionNameSalary
2008/11/2833TokyoAccountantAiri Satou $162,700
2009/10/0947LondonChief Executive Officer (CEO)Angelica Ramos $1,200,000
2009/01/1266San FranciscoJunior Technical AuthorAshton Cox $86,000
2012/10/1341LondonSoftware EngineerBradley Greer $132,000
2011/06/0728San FranciscoSoftware EngineerBrenden Wagner $206,850
2012/12/0261New YorkIntegration SpecialistBrielle Williamson $372,000
2011/05/0338LondonSoftware EngineerBruno Nash $163,500
2011/12/1221New YorkPre-Sales SupportCaesar Vance $106,450
2011/12/0646New YorkSales AssistantCara Stevens $145,600
2012/03/2922EdinburghSenior Javascript DeveloperCedric Kelly $433,060
Showing 1 to 10 of 57 entries

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

$(document).ready(function() { $('#example').dataTable( { colReorder: { order: [ 4, 3, 2, 1, 0, 5 ] } } ); } );

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.