Subversion-Projekte lars-tiefland.zeldi.de_alt

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
2 lars 1
/**
2
 * DataTables internal date sorting replies on `Date.parse()` which is part of
3
 * the Javascript language, but you may wish to sort on dates which is doesn't
4
 * recognise. The following is a plug-in for sorting dates in the format
5
 * `dd/mm/yy`.
6
 *
7
 * An automatic type detection plug-in is available for this sorting plug-in.
8
 *
9
 * Please note that this plug-in is **deprecated*. The
10
 * [datetime](//datatables.net/blog/2014-12-18) plug-in provides enhanced
11
 * functionality and flexibility.
12
 *
13
 *  @name Date (dd/mm/YY)
14
 *  @summary Sort dates in the format `dd/mm/YY`
15
 *  @author Andy McMaster
16
 *  @deprecated
17
 *
18
 *  @example
19
 *    $('#example').dataTable( {
20
 *       columnDefs: [
21
 *         { type: 'date-uk', targets: 0 }
22
 *       ]
23
 *    } );
24
 */
25
 
26
 jQuery.extend( jQuery.fn.dataTableExt.oSort, {
27
	"date-uk-pre": function ( a ) {
28
		if (a == null || a == "") {
29
			return 0;
30
		}
31
		var ukDatea = a.split('/');
32
		return (ukDatea[2] + ukDatea[1] + ukDatea[0]) * 1;
33
	},
34
 
35
	"date-uk-asc": function ( a, b ) {
36
		return ((a < b) ? -1 : ((a > b) ? 1 : 0));
37
	},
38
 
39
	"date-uk-desc": function ( a, b ) {
40
		return ((a < b) ? 1 : ((a > b) ? -1 : 0));
41
	}
42
} );