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 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55
|
<?xml version="1.0" encoding="UTF-8" ?>
<dt-api group="core">
<name>order.fixed()</name>
<summary>Get / set the fixed ordering applied to the table.</summary>
<since>1.10.10</since>
<type type="function">
<signature>order.fixed()</signature>
<description>Get the fixed ordering that is applied to the table. If there is more than one table in the API's context, the ordering of the first table will be returned only (use `dt-api table()` if you require the ordering of a different table in the API's context).</description>
<returns type="object">
The returned object may have two properties:
* `pre` - Ordering to be applied _before_ the user's own ordering
* `post` - Ordering to be applied _after_ the user's own ordering
Each property may not be defined, in which case there is no ordering applied from it.
</returns>
</type>
<type type="function">
<signature>order.fixed( order )</signature>
<description>Set the table's fixed ordering. Note this doesn't actually perform the order, but rather queues it up - use `dt-api draw()` to perform the ordering.</description>
<parameter type="object" name="order">
An object which may have neither, one or both of the following properties:
* `pre` - Ordering to be applied _before_ the user's own ordering
* `post` - Ordering to be applied _after_ the user's own ordering
</parameter>
<returns type="DataTables.Api">DataTables API instance</returns>
</type>
<description>
This method provides the ability to control the fixed ordering that is applied to a DataTable. The "fixed" ordering is a column order that will be applied to a table's ordering before and / or after the user's ordering is applied. Consider for example a table which you wish to always order by column 0, this method (or `dt-init orderFixed`) could be used to apply that fixed order, while the end user would then be able to add their own ordering to the table thanks to DataTables' multi-column ordering.
The fixed ordering can be applied before (`pre`) or after (`post`) the user's own ordering criteria using the two different properties that can be given in the value for this method, when used as a setter.
The values that are used to describe the ordering conditions for the table are given as two element arrays:
* Column index to order upon
* Direction so order to apply (`-string asc` for ascending order or `-string desc` for descending order).
It is also possible to give a set of nested arrays (i.e. arrays in arrays) to allow multi-column ordering to be assigned.
</description>
<example title="Set the fixed ordering of the table"><![CDATA[
var table = $('#example').DataTable();
table.order.fixed( {
pre: [ 0, 'asc' ]
} );
]]></example>
<related type="option">ordering</related>
<related type="option">order</related>
<related type="api">order()</related>
</dt-api>
|