1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
|
<?xml version="1.0" encoding="UTF-8" ?>
<dt-api group="columns">
<name>column().order()</name>
<summary>Order the table by the selected column.</summary>
<since>1.10</since>
<type type="function">
<signature>column().order( direction )</signature>
<description>Order the table, in the direction specified, by the column selected by the `dt-api column()` selector.</description>
<parameter type="string" name="direction">
Direction of sort to apply to the selected column - `dt-string desc` (descending) or `dt-string asc` (ascending).
</parameter>
<returns type="DataTables.Api">DataTables API instance</returns>
</type>
<description>
This method provides a useful alternative to the `dt-api order()` method, allowing you to select the column that you want to be ordered using the flexible `dt-api column()` selector and having it ordered in the direction specified.
Note that if the selector used for `dt-api column()` matches more than one column, the result will be truncated to a single column. To perform multi-column ordering, please use `dt-api columns().order()` or `dt-api order()`.
Please be aware that this method sets the ordering to apply to the table - it does not actually perform the order. In order to have the order performed, use the `dt-api draw()` method, which can be called simply as a chained method of the `dt-api order()` method's returned object - for example `table.order([0, 'desc']).draw();`.
</description>
<example title="Sort by the first visible column"><![CDATA[
var table = $('#example').DataTable();
table
.column( '0:visible' )
.order( 'asc' )
.draw();
]]></example>
<related type="option">order</related>
<related type="option">ordering</related>
<related type="api">order()</related>
<related type="api">columns().order()</related>
</dt-api>
|