A table sorting example
This code was heavily copied from
http://www.kryogenix.org/code/browser/sorttable/.
It requires the Prototype.js library available from
http://prototype.conio.net/
(the version included on this site is from the
script.aculo.us distribution).
Download .js file.
Contact me at:

New features:
- User specified "arrow" text (because innerHTML is used to set the text, it should
be possible to specify an <img> tag for the arrow text)
- Uses HTML TFOOT element to identify footer (as opposed to a special
class)
- Can specify alternating row classes (e.g. so every two or three rows is a
different color)
- Because the arrows are hidden instead of replaced with spaces, columns won't
shrink/expand when sorting
- Supports heterogeneous column types
- Optionally uses the Natural Order algorithm to compare text
(still converts purely numeric values to floats for comparison)
- No more <a> links in the headers--I can't stand those #'s appearing in the
URL
- Supports the newest Prototype.js library that breaks the symantics of the Array.reverse() method
- Other small fixes and improvements (see comments in .js file)
| Distributor |
1,000 |
4,000 |
8,000 |
12,000 |
16,000 |
24,000 |
32,000 |
48,000 |
| Some Company A |
n/a |
0.0130 |
0.0130 |
0.0120 |
0.0120 |
0.0120 |
0.0120 |
tom 2 |
| Some Company B |
n/a |
Abba |
0.0120 |
0.0090 |
0.0090 |
0.0090 |
0.0090 |
tom 10 |
| Some Company C |
n/a |
Badda |
0.0106 |
0.0083 |
0.0083 |
0.0078 |
0.0078 |
1111 tom |
| Some Company D |
n/a |
-34.5 |
0.0311 |
0.0311 |
0.0311 |
0.0276 |
0.0276 |
22 tom |
| Some Company E |
n/a |
998.3 |
0.0061 |
0.0061 |
0.0056 |
0.0056 |
0.0053 |
22 tom 334 |
| Some Company E |
n/a |
998.3 |
0.0061 |
0.0061 |
0.0056 |
0.0056 |
0.0053 |
22.0 tom 335 |
| Just another Company |
0.0160 |
-0.34 |
0.0100 |
0.0100 |
0.0100 |
0.0100 |
0.0100 |
22 tom 00003444 |
| I am the footer row |
I |
Will |
Never |
Sort |
|
Not |
at |
all |