{hero}

column().orderable()

Since: DataTables 2.0

Get information about the orderable status of a column.

Description

This method provides the ability to programmatically check if a given column is orderable by the end user (a click on the header cell) and optionally to get the ordering directions that the column can take, as defined by columns.orderSequence.

Type

function column().order( [ directions ] )

Description:

Get information about the orderable status of a column (enabled or not and what ordering directions are available).

Parameters:
Returns:

DataTables API instance containing true or false depending on the column's orderable state if directions is undefined or false. If the parameter passed in is true the method will return information about what ordering directions this column can take (see columns.orderSequence).

Example

Check if the first column is orderable by the end user, and if so, order on it:

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

if (table.column(0).orderable()) {
	table
		.column(0)
		.order()
		.draw();
}

Related

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