You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I found that the "digit" metadata sorter doesn't work on large numbers that contain commas. My current fix was to add the following code to the jquery.tablesorter.js
The default digit parser should be replacing commas & decimals based on the usNumberFormat option.
I'm not sure what is meant by "humanReadableNumber", since to me "one hundred and fifty" is a human readable number, and the above parser has a regular expression in the is function detecting numbers. The format function is very generic and would throw a javascript error if the s value was undefined (empty table).
There is already a named numbers parser (parser-named-numbers.js) with a demo. It will need an update to ignore commas, so I'll push a fix for that shortly.
Human readable may have been a poor label. Comma delimited is probably more apt.
i.e 1,234,567
What I found using the 'digit' parser was that all numbers after the first comma were ignored in the sort order. So
1,234,567
234
74,234
23
23,546
was sorted to
1,234,567
23
23,546
74,234
234
The problem is that your format function uses parseFloat. Whilst the "is" function will match a comma delimited number parseFloat will not return correctly, see the following:
I found that the "digit" metadata sorter doesn't work on large numbers that contain commas. My current fix was to add the following code to the jquery.tablesorter.js
Is there a better way to do this?
The text was updated successfully, but these errors were encountered: