Subversion-Projekte lars-tiefland.zeldi.de

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
2 lars 1
/**
2
 * Just like the _hidden title numeric sorting_ plug-in, this sorting plug-in
3
 * will take the information to be sorted on from the title attribute of a span
4
 * element. The only difference is that it is string based sorting rather than
5
 * numeric.
6
 *
7
 * Note that the HTML5 `data-sort` attribute can be [used to supply sorting data
8
 * to DataTables](//datatables.net/manual/orthogonal-data) and is preferable to
9
 * using this method, which is therefore marked as deprecated.
10
 *
11
 *  @name Hidden title string sorting
12
 *  @summary Sort data as a string based on an attribute on an empty element.
13
 *  @author [Allan Jardine](http://sprymedia.co.uk)
14
 *  @deprecated
15
 *
16
 *  @example
17
 *    $('#example').dataTable( {
18
 *       columnDefs: [
19
 *         { type: 'title-string', targets: 0 }
20
 *       ]
21
 *    } );
22
 */
23
 
24
jQuery.extend( jQuery.fn.dataTableExt.oSort, {
25
	"title-string-pre": function ( a ) {
26
		return a.match(/title="(.*?)"/)[1].toLowerCase();
27
	},
28
 
29
	"title-string-asc": function ( a, b ) {
30
		return ((a < b) ? -1 : ((a > b) ? 1 : 0));
31
	},
32
 
33
	"title-string-desc": function ( a, b ) {
34
		return ((a < b) ? 1 : ((a > b) ? -1 : 0));
35
	}
36
} );