order

Since: 1.10

Initial order (sort) to apply to the table

Description

If ordering is enabled (orderingDT), then DataTables will perform a first pass order during initialisation. Using this parameter you can define which column(s) the order is performed upon, and the ordering direction. The orderDT option can take two forms:

  • An array with two entries:
    • Column index to order upon
    • Direction so order to apply (asc or desc)
  • An array of arrays, each inner array with the two options above. This allows a multi-column order to be defined as the initial state.

Type

This option can be given in the following type(s):

Default

  • Value: [[0, 'asc']]

Examples

No initial order:

$('#example').dataTable( {
	"order": []
} );

Sortng on column index 1 (second column) initially:

$('#example').dataTable( {
	"order": [ 1, 'asc' ]
} );

Multi-column ordering as the initial state:

$('#example').dataTable( {
	"order": [[ 0, 'asc' ], [ 1, 'asc' ]]
} );

Related

The following options are directly related and may also be useful in your application development.