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
|
<?xml version="1.0" encoding="UTF-8" ?>
<dt-option group="columns">
<name>columns.orderData</name>
<summary>Define multiple column ordering as the default order for a column</summary>
<since>1.10</since>
<type type="integer">
<description>A single column index to order upon</description>
</type>
<type type="array">
<description>Multiple column indexes to define multi-column sorting</description>
</type>
<default>
Takes the index value of the column automatically
</default>
<description>
Allows a column's sorting to take either the data from a different (often hidden) column as the data to sort, or data from multiple columns.
A common example of this is a table which contains first and last name columns next to each other, it is intuitive that they would be linked together to multi-column sort. Another example, with a single column, is the case where the data shown to the end user is not directly sortable itself (a column with images in it), but there is some meta data than can be sorted (e.g. file name) - note that [orthogonal data](/manual/data/orthogonal-data) is an alternative method that can be used for this.
</description>
<example title="Using `orderData` to define multi-column sorting with `dt-init columnDefs`"><![CDATA[
$('#example').dataTable( {
"columnDefs": [
{ "orderData": [ 0, 1 ], "targets": 0 },
{ "orderData": 0, "targets": 1 },
{ "orderData": [ 2, 3, 4 ], "targets": 2 }
]
} );
]]></example>
<example title="Using `orderData` to define multi-column sorting with `dt-init columns`"><![CDATA[
$('#example').dataTable( {
"columns": [
{ "orderData": [ 0, 1 ] },
{ "orderData": 0, },
{ "orderData": [ 2, 3, 4 ] },
null,
null
]
} );
]]></example>
<related type="option">ordering</related>
<related type="option">order</related>
<related type="api">order()</related>
<related type="api">column().order()</related>
<related type="api">columns().order()</related>
</dt-option>
|