Formatted Number Type Detection Bug

Formatted Number Type Detection Bug

gullbyrdgullbyrd Posts: 2Questions: 0Answers: 0
edited February 2012 in General
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]

Replies

  • allanallan Posts: 63,542Questions: 1Answers: 10,476 Site admin
    Soopid me :-(. Sorry about that - I changed it just a few days ago and inadvertently introduced that error. Now fixed. Thanks for flagging it up!

    Allan
This discussion has been closed.