{hero}

order

Since: DataTables 1.10

order event - fired when the data contained in the table is ordered.

Description

The order event is fired whenever the data in the table is ordered. This is typically triggered by the end user ordering a column, but can also be initiated through the order() method and when a full redraw (by calling the draw()) occurs.

Note that the page will be fired before the table has been redrawn with the updated data, although the data will internally have been ordered.

Please note that, as with all DataTables emitted events, this event is triggered with the dt namespace. As such, to listen for this event, you must also use the dt namespace by simply appending .dt to your event name, as shown in the example below.

Type

function function( e, settings )

Parameters:

Example

Show information about the current order using the API:

var table = $('#example').DataTable();

$('#example').on( 'order.dt', function () {
	// This will show: "Ordering on column 1 (asc)", for example
	var order = table.order();
	$('#orderInfo').html( 'Ordering on column '+order[0][0]+' ('+order[0][1]+')' );
} );

Related

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