orderCellsTop
Control which cell the order event handler will be applied to in a column.
Deprecated!
As of v2.0.0 this feature has been deprecated. This feature has not yet been scheduled for removal, but its use is discouraged and the alternatives discussed below should be used.
Description
Allows control over whether DataTables should use the top (true
) unique cell that is found for a single column, or the bottom (false
) to attach the default order listener and display sorting icons. This can be useful when using complex headers.
As of DataTables 2, if the value of this parameter is given as null
(which it is by default) all cells in the header will automatically have the sort listener attached and icons shown.
Consider for example the following HTML header:
<thead>
<tr>
<td rowspan="2">1</td>
<td>2.1</td>
</tr>
<tr>
<td>2.2</td>
</tr>
</thead>
In this case, when orderCellsTop
is false
the cells 1
and 2.2
will have the order event listener applied to them. If orderCellsTop
is true
then 1
and 2.1
will have the order event listeners applied to them. Finally, if the value is given is null
(default), all cells will have the ordering event listeners attached.
Type
This option can be given in the following type(s):
Default
null
Example
Use the top cells in a complex header for ordering:
new DataTable('#myTable', {
orderCellsTop: true
});
Related
The following options are directly related and may also be useful in your application development.