| 41 |
lars |
1 |
/**
|
|
|
2 |
* This function will restore the order in which data was read into a DataTable
|
|
|
3 |
* (for example from an HTML source). Although you can set `dt-api order()` to
|
|
|
4 |
* be an empty array (`[]`) in order to prevent sorting during initialisation,
|
|
|
5 |
* it can sometimes be useful to restore the original order after sorting has
|
|
|
6 |
* already occurred - which is exactly what this function does.
|
|
|
7 |
*
|
|
|
8 |
* @name order.neutral()
|
|
|
9 |
* @summary Change ordering of the table to its data load order
|
|
|
10 |
* @author [Allan Jardine](http://datatables.net)
|
|
|
11 |
* @requires DataTables 1.10+
|
|
|
12 |
*
|
|
|
13 |
* @returns {DataTables.Api} DataTables API instance
|
|
|
14 |
*
|
|
|
15 |
* @example
|
|
|
16 |
* // Return table to the loaded data order
|
|
|
17 |
* table.order.neutral().draw();
|
|
|
18 |
*/
|
|
|
19 |
|
|
|
20 |
$.fn.dataTable.Api.register( 'order.neutral()', function () {
|
|
|
21 |
return this.iterator( 'table', function ( s ) {
|
|
|
22 |
s.aaSorting.length = 0;
|
|
|
23 |
s.aiDisplay.sort();
|
|
|
24 |
s.aiDisplayMaster.sort();
|
|
|
25 |
} );
|
|
|
26 |
} );
|