You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Plugins/sorting/currency.js

24 lines
626 B
JavaScript

/**
* This plug-in will provide numeric sorting for currency columns (either
* detected automatically with the currency type detection plug-in or set
* manually) while taking account of the currency symbol ($ or £ by default).
* @name Currency
13 years ago
* @anchor currency
* @author <a href="http://sprymedia.co.uk">Allan Jardine</a>
*/
jQuery.extend( jQuery.fn.dataTableExt.oSort, {
"currency-pre": function ( a ) {
a = (a==="-") ? 0 : a.replace( /[^\d\-\.]/g, "" );
return parseFloat( a );
},
"currency-asc": function ( a, b ) {
return a - b;
},
"currency-desc": function ( a, b ) {
return b - a;
}
} );