Subversion-Projekte lars-tiefland.cienc

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
9 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 aaSorting to be an
4
 * empty array (`[ ]`) in order to prevent sorting during initialisation, it can
5
 * sometimes be useful to restore the original order after sorting has already
6
 * occurred - which is exactly what this function does.
7
 *
8
 *  @name fnSortNeutral
9
 *  @summary Change ordering of the table to its data load order
10
 *  @author [Allan Jardine](http://sprymedia.co.uk)
11
 *
12
 *  @example
13
 *    $(document).ready(function() {
14
 *        var table = $('#example').dataTable();
15
 *
16
 *        // Sort in the order that was originally in the HTML
17
 *        table.fnSortNeutral();
18
 *    } );
19
 */
20
 
21
jQuery.fn.dataTableExt.oApi.fnSortNeutral = function ( oSettings )
22
{
23
	/* Remove any current sorting */
24
	oSettings.aaSorting = [];
25
 
26
	/* Sort display arrays so we get them in numerical order */
27
	oSettings.aiDisplay.sort( function (x,y) {
28
		return x-y;
29
	} );
30
	oSettings.aiDisplayMaster.sort( function (x,y) {
31
		return x-y;
32
	} );
33
 
34
	/* Redraw */
35
	oSettings.oApi._fnReDraw( oSettings );
36
};