Sha256: 0a6b657689948cc00e084028a0698b2d0c2c6393c09c95360f20ab110a895713

Contents?: true

Size: 1.2 KB

Versions: 28

Compression:

Stored size: 1.2 KB

Contents

$.extend( DataTable.ext.oSort, {
	/*
	 * text sorting
	 */
	"string-pre": function ( a )
	{
		if ( typeof a != 'string' ) {
			a = (a !== null && a.toString) ? a.toString() : '';
		}
		return a.toLowerCase();
	},

	"string-asc": function ( x, y )
	{
		return ((x < y) ? -1 : ((x > y) ? 1 : 0));
	},
	
	"string-desc": function ( x, y )
	{
		return ((x < y) ? 1 : ((x > y) ? -1 : 0));
	},
	
	
	/*
	 * html sorting (ignore html tags)
	 */
	"html-pre": function ( a )
	{
		return a.replace( /<.*?>/g, "" ).toLowerCase();
	},
	
	"html-asc": function ( x, y )
	{
		return ((x < y) ? -1 : ((x > y) ? 1 : 0));
	},
	
	"html-desc": function ( x, y )
	{
		return ((x < y) ? 1 : ((x > y) ? -1 : 0));
	},
	
	
	/*
	 * date sorting
	 */
	"date-pre": function ( a )
	{
		var x = Date.parse( a );
		
		if ( isNaN(x) || x==="" )
		{
			x = Date.parse( "01/01/1970 00:00:00" );
		}
		return x;
	},

	"date-asc": function ( x, y )
	{
		return x - y;
	},
	
	"date-desc": function ( x, y )
	{
		return y - x;
	},
	
	
	/*
	 * numerical sorting
	 */
	"numeric-pre": function ( a )
	{
		return (a=="-" || a==="") ? 0 : a*1;
	},

	"numeric-asc": function ( x, y )
	{
		return x - y;
	},
	
	"numeric-desc": function ( x, y )
	{
		return y - x;
	}
} );

Version data entries

28 entries across 28 versions & 1 rubygems

Version Path
classiccms-0.7.5 lib/classiccms/public/admin/datatables/src/ext/ext.sorting.js
classiccms-0.7.4 lib/classiccms/public/admin/datatables/src/ext/ext.sorting.js
classiccms-0.7.3 lib/classiccms/public/admin/datatables/src/ext/ext.sorting.js
classiccms-0.7.2 lib/classiccms/public/admin/datatables/src/ext/ext.sorting.js
classiccms-0.7.1 lib/classiccms/public/admin/datatables/src/ext/ext.sorting.js
classiccms-0.7.0 lib/classiccms/public/admin/datatables/src/ext/ext.sorting.js
classiccms-0.6.9 lib/classiccms/public/admin/datatables/src/ext/ext.sorting.js
classiccms-0.6.8 lib/classiccms/public/admin/datatables/src/ext/ext.sorting.js
classiccms-0.6.7 lib/classiccms/public/admin/datatables/src/ext/ext.sorting.js
classiccms-0.6.6 lib/classiccms/public/admin/datatables/src/ext/ext.sorting.js
classiccms-0.6.5 lib/classiccms/public/admin/datatables/src/ext/ext.sorting.js
classiccms-0.6.4 lib/classiccms/public/admin/datatables/src/ext/ext.sorting.js
classiccms-0.6.3 lib/classiccms/public/admin/datatables/src/ext/ext.sorting.js
classiccms-0.6.2 lib/classiccms/public/admin/datatables/src/ext/ext.sorting.js
classiccms-0.6.1 lib/classiccms/public/admin/datatables/src/ext/ext.sorting.js
classiccms-0.6.0 lib/classiccms/public/admin/datatables/src/ext/ext.sorting.js
classiccms-0.5.17 lib/classiccms/public/admin/datatables/src/ext/ext.sorting.js
classiccms-0.5.16 lib/classiccms/public/admin/datatables/src/ext/ext.sorting.js
classiccms-0.5.15 lib/classiccms/public/admin/datatables/src/ext/ext.sorting.js
classiccms-0.5.14 lib/classiccms/public/admin/datatables/src/ext/ext.sorting.js