orderCellsTop

Since: DataTables 1.10

Control which cell the order event handler will be applied to in a column.

Description

Allows control over whether DataTables should use the top (true) unique cell that is found for a single column, or the bottom (false - default) to attach the default order listener. This is useful when using complex headers.

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 (default) 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.

Type

This option can be given in the following type(s):

Default

false

Example

Use the top cells in a complex header for ordering:

$('#example').dataTable( {
  "orderCellsTop": true
} );

Related

The following options are directly related and may also be useful in your application development.