Formatted Number Type Detection Bug
Formatted Number Type Detection Bug
Surely this has already been reported, but the plug-in code for Formatted Number Type Detection includes this block:
[code]
jQuery.fn.dataTableExt.oSort['formatted-num-desc'] = function(a,b) {
var x = a.match(/\d/) ? a.replace( /[^\d\-\.]/g, "" ) : 0;
var y = b.match(/\d/) ? b.replace( /[^\d\-\.]/g, "" ) : 0;
return parseFloat(x) + parseFloat(y);
};
[/code]
How is adding the two values together supposed to work for generating a comparison? Replace it with
[code]return parseFloat(y) - parseFloat(x);[/code]
[code]
jQuery.fn.dataTableExt.oSort['formatted-num-desc'] = function(a,b) {
var x = a.match(/\d/) ? a.replace( /[^\d\-\.]/g, "" ) : 0;
var y = b.match(/\d/) ? b.replace( /[^\d\-\.]/g, "" ) : 0;
return parseFloat(x) + parseFloat(y);
};
[/code]
How is adding the two values together supposed to work for generating a comparison? Replace it with
[code]return parseFloat(y) - parseFloat(x);[/code]
This discussion has been closed.
Replies
Allan