Since: DataTables 1.10

Order the table by the selected column.


This method provides a useful alternative to the order() method, allowing you to select the column that you want to be ordered using the flexible column() selector and having it ordered in the direction specified. As of v2 it also allows you to obtain ordering information about the selected column - determining if it is used in the current order of the table and what ordering direction.

Note that if the selector used for column() matches more than one column, the result will be truncated to a single column. To perform multi-column ordering, please use columns().order() or order().

Please be aware that when used as a setter, this method sets the ordering to apply to the table - it does not actually perform the order. To have the ordering performed, use the draw() method, which can be called simply as a chained method of the order() method's returned object - for example table.order([0, 'desc']).draw();.


function column().order()


Determine if the table is being ordered by this column.


DataTables API instance containing asc, desc or an empty string (indicating index data order) for the possible ordering applied to a column. If a column is not being ordered on, null is given.

function column().order( direction )


Order the table, in the direction specified, by the column selected by the column() selector.


DataTables API instance


Sort by the first visible column:

var table = new DataTable('#myTable');



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