{hero}

reverse()

Since: DataTables 1.10

Reverse the result set of the API instance.

Description

This method will quite simply take the elements in an API instance's result set and reverse the order of those element, in place. This is particularly used when used with the sort() method.

This method makes use of the fact that DataTables API objects are "array like", in that they inherit a lot of the abilities and methods of the Javascript Array type.

In this case, this method is a proxy for the Javascript Array.prototype.reverse method and is provided as a utility method for the DataTables API. For more information about the original method, please refer to the Mozilla MDN documentation for reverse.

Type

function reverse()

Description:

Reverse the result set of the API instance and return the original array.

Returns:

The original API instance with the result set in reversed order.

Example

Sort and reverse the data from a column:

var table = new DataTable('#myTable');

var data = table
	.column(0)
	.data()
	.sort()
	.reverse();