Subversion-Projekte lars-tiefland.zeldi.de_alt

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
2 lars 1
/**
2
 * Sort on the 'alt' tag of images in a column. This is particularly useful if
3
 * you have a column of images (ticks and crosses for example) and you want to
4
 * control the sorting using the alt tag.
5
 *
6
 *  @name Alt string
7
 *  @summary Use the `alt` attribute of an image tag as the data to sort upon.
8
 *  @author _Jumpy_
9
 *
10
 *  @example
11
 *    $('#example').dataTable( {
12
 *       columnDefs: [
13
 *         { type: 'alt-string', targets: 0 }
14
 *       ]
15
 *    } );
16
 */
17
 
18
jQuery.extend( jQuery.fn.dataTableExt.oSort, {
19
	"alt-string-pre": function ( a ) {
20
		return a.match(/alt="(.*?)"/)[1].toLowerCase();
21
	},
22
 
23
	"alt-string-asc": function( a, b ) {
24
		return ((a < b) ? -1 : ((a > b) ? 1 : 0));
25
	},
26
 
27
	"alt-string-desc": function(a,b) {
28
		return ((a < b) ? 1 : ((a > b) ? -1 : 0));
29
	}
30
} );