Subversion-Projekte lars-tiefland.zeldi.de_alt

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
2 lars 1
/**
2
 * This plug-in will provide numeric sorting for numeric columns which have
3
 * extra formatting, such as thousands separators, currency symbols or any other
4
 * non-numeric data.
5
 *
6
 * By default when a cell is found to have no numeric data its value is sorted
7
 * numerically as if its value were 0. This could also be altered to be Inifnity
8
 * or -Infinity as required.
9
 *
10
 * DataTables 1.10+ has formatted number detection and sorting abilities built-
11
 * in. As such this plug-in is marked as deprecated, but might be useful when
12
 * working with old versions of DataTables.
13
 *
14
 *  @name Formatted numbers
15
 *  @summary Sort numbers which are displayed with thousand separators
16
 *  @deprecated
17
 *  @author [Allan Jardine](http://sprymedia.co.uk)
18
 *
19
 *  @example
20
 *    $('#example').dataTable( {
21
 *       columnDefs: [
22
 *         { type: 'formatted-num', targets: 0 }
23
 *       ]
24
 *    } );
25
 */
26
 
27
jQuery.extend( jQuery.fn.dataTableExt.oSort, {
28
	"formatted-num-pre": function ( a ) {
29
		a = (a === "-" || a === "") ? 0 : a.replace( /[^\d\-\.]/g, "" );
30
		return parseFloat( a );
31
	},
32
 
33
	"formatted-num-asc": function ( a, b ) {
34
		return a - b;
35
	},
36
 
37
	"formatted-num-desc": function ( a, b ) {
38
		return b - a;
39
	}
40
} );