I’m using the javascript class sorttable for my tables (see here: http://www.kryogenix.org/code/browser/sorttable/)
However, I have a table that uses scientific notation. When I sort the column it looks like this…
9.43947E-20
9.41332E-22
9.36423E-22
9.35113E-18
9.2744E-23
9.18754E-22
9.09174
8.3981E-22
7.72743E-19
7.69538E-18
7.23656E-19
It is not properly sorted. I want it to look like this…
9.09174
9.35113E-18
7.69538E-18
7.72743E-19
7.23656E-19
9.43947E-20
9.41332E-22
9.36423E-22
8.3981E-22
9.2744E-23
Is there a javascript function that can do this? Thanks.
The above will work using my sorTable library (which happens to also use jQuery on the back currently):
Demo: http://jsfiddle.net/bBJBa/1/
They key is to convert the string value to numbers using something like
*1orparseFloatinstead ofparseInt.