BUG in TableSorter isDigit function

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

BUG in TableSorter isDigit function


This affects column type detection in the detectParserForColumn
function.  If your table has a true ZERO in the first row, the column
will always be interpreted as text no matter what.  The problem is
that the isDigit function says that 0 is not a digit.

return RegExp(exp).test($.trim("0"));
return RegExp(exp).test($.trim("1"));
return RegExp(exp).test($.trim("012"));

The idea, I believe, is to interpret values with a leading zero as
text... in this case, however, it's not a leading zero, it's an actual

The regular expression used is quite the beast... needs to be modified
to accept a single zero as a valid decimal as I'm sure this is quite
common.  The workaround, of course, is to set your parser explicitly
when you set up your sorter.

Here's the expression for reference:

You received this message because you are subscribed to the Google Groups "jQuery Plugins" group.
To post to this group, send email to [hidden email]
To unsubscribe from this group, send email to [hidden email]
For more options, visit this group at http://groups.google.com/group/jquery-plugins?hl=en