Subversion-Projekte lars-tiefland.cienc

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
8 lars 1
/**
2
 * This plug-in will treat numbers which are in scientific notation (for
3
 * example `1E-10`, `1.2E6` etc) and sort them numerically.
4
 *
5
 *  @name Scientific notation sorting
6
 *  @summary Sort data which is written in exponential notation.
7
 *  @author [Nick Schurch](http://datatables.net/forums/profile/21757/nickschurch)
8
 *
9
 *  @example
10
 *    $('#example').dataTable( {
11
 *       columnDefs: [
12
 *         { type: 'scientific', targets: 0 }
13
 *       ]
14
 *    } );
15
 */
16
 
17
jQuery.extend( jQuery.fn.dataTableExt.oSort, {
18
	"scientific-pre": function ( a ) {
19
		return parseFloat(a);
20
	},
21
 
22
	"scientific-asc": function ( a, b ) {
23
		return ((a < b) ? -1 : ((a > b) ? 1 : 0));
24
	},
25
 
26
	"scientific-desc": function ( a, b ) {
27
		return ((a < b) ? 1 : ((a > b) ? -1 : 0));
28
	}
29
} );