Add formatting numbers back into the list - in terms of the sorting function it is the same as the currency sort, in that it simply strips all non-numeric data, but there are a number of references to this plug-in so it makes sense to put it back in.

pull/2/head
Allan Jardine 13 years ago
parent 8fc0f66cfb
commit e2a8c4484d

@ -0,0 +1,23 @@
/**
* This plug-in will provide numeric sorting for numeric columns which have extra
* formatting, such as thousands seperators, currency symobols or any other
* non-numeric data.
* @name Formatted numbers
* @anchor formatted_numbers
* @author <a href="http://sprymedia.co.uk">Allan Jardine</a>
*/
jQuery.extend( jQuery.fn.dataTableExt.oSort, {
"formatted_numbers-pre": function ( a ) {
a = (a==="-") ? 0 : a.replace( /[^\d\-\.]/g, "" );
return parseFloat( a );
},
"formatted_numbers-asc": function ( a, b ) {
return a - b;
},
"formatted_numbers-desc": function ( a, b ) {
return b - a;
}
} );
Loading…
Cancel
Save