column().orderable()
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:
Name Type Optional 1 directions
Yes - default:false Controls the information that is returned - see below for details. Can be not given (undefined),
false
ortrue
.- Returns:
DataTables API instance containing
true
orfalse
depending on the column's orderable state ifdirections
is undefined or false. If the parameter passed in istrue
the method will return information about what ordering directions this column can take (seecolumns.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.