Fix: Formatted numbers type detection and sorting names didn't quite match

Fix: Formatted numbers type detection wasn't allowing just a dash, while the sorting plug-in did - they now both do
pull/2/head
Allan Jardine 13 years ago
parent cb7b8ac3bb
commit 27c1c7ed96

@ -8,16 +8,16 @@
*/ */
jQuery.extend( jQuery.fn.dataTableExt.oSort, { jQuery.extend( jQuery.fn.dataTableExt.oSort, {
"formatted_numbers-pre": function ( a ) { "formatted-num-pre": function ( a ) {
a = (a==="-") ? 0 : a.replace( /[^\d\-\.]/g, "" ); a = (a==="-") ? 0 : a.replace( /[^\d\-\.]/g, "" );
return parseFloat( a ); return parseFloat( a );
}, },
"formatted_numbers-asc": function ( a, b ) { "formatted-num-asc": function ( a, b ) {
return a - b; return a - b;
}, },
"formatted_numbers-desc": function ( a, b ) { "formatted-num-desc": function ( a, b ) {
return b - a; return b - a;
} }
} ); } );

@ -14,7 +14,7 @@ jQuery.fn.dataTableExt.aTypes.unshift(
function ( sData ) function ( sData )
{ {
var deformatted = sData.replace(/[^\d\-\.\/a-zA-Z]/g,''); var deformatted = sData.replace(/[^\d\-\.\/a-zA-Z]/g,'');
if ( $.isNumeric( deformatted ) ) { if ( $.isNumeric( deformatted ) || deformatted === "-" ) {
return 'formatted-num'; return 'formatted-num';
} }
return null; return null;

Loading…
Cancel
Save