Subversion-Projekte lars-tiefland.cienc

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
8 lars 1
/**
2
 * This sorting plug-in will sort, in calendar order, data which
3
 * is in the format "MM YY".
4
 *
5
 * Please note that this plug-in is **deprecated*. The
6
 * [datetime](//datatables.net/blog/2014-12-18) plug-in provides enhanced
7
 * functionality and flexibility.
8
 *
9
 *  @name Date (MM YY)
10
 *  @anchor Sort dates in the format `MM YY`
11
 *  @author Michael Motek
12
 *  @deprecated
13
 *
14
 *  @example
15
 *    $('#example').dataTable( {
16
 *       columnDefs: [
17
 *         { type: 'monthYear', targets: 0 }
18
 *       ]
19
 *    } );
20
 */
21
 
22
jQuery.extend( jQuery.fn.dataTableExt.oSort, {
23
	"monthYear-pre": function ( s ) {
24
		var a = s.split(' ');
25
		// Date uses the American "MM DD YY" format
26
		return new Date(a[0]+' 01 '+a[1]);
27
	},
28
 
29
	"monthYear-asc": function ( a, b ) {
30
		return ((a < b) ? -1 : ((a > b) ? 1 : 0));
31
	},
32
 
33
	"monthYear-desc": function ( a, b ) {
34
		return ((a < b) ? 1 : ((a > b) ?  -1 : 0));
35
	}
36
} );