About This Product
Metachecker.net | TrafficChecker.net | RankChecker.net
| Over 5000 Free Fonts | Tutorials | Javascript Forum | Other Javascript Resources | Cheat Sheet


Table Sorting is a curtesy of WebFX
See Original Here

[Tell A Friend]

Sample

Just click at the table headers to sort by that column

Item Name Date
Item 3 Steven 950227
Item 2 Emil 990227
Item 1 Erik 990228
Item 4 Scott 960227
Item 7 Fabian 970227
Item 6 Thomas 900227
Item 5 Mike 880227
Item 8 Adam 930227
Item 11 Bill 940227
Item 10 Marc 890227
Item 9 Linus 980227
Item 12 Ronald 960227
Item 15 Peter 950227
Item 14 Carlos 910227
Item 13 Paul 920227
Item 16 Arnold 960227

What do I need to use this

You need to download tablesort.js file and include it by adding the following line to your document HEAD:

<script type="text/javascript" src="tablesort.js"></script>

You also need to organise your table into a table head and a table body and add the onclick handler to the table tag. The table should look like this:

<table onclick="sortColumn(event)">
<thead>
	<tr>...</tr>
	...
</thead>
<tbody>
	<tr>...</tr>
	...
</tbody>
</table>

You don't need to include a special CSS file but I recomend that you do it anyway because that the arrow should use the webdings font. Download tablesort.css and add the following line to the HEAD:

<link rel="STYLESHEET" type="text/css" href="tablesort.css">

What's next



Defining the sort
Manipulating the DOM tree
Demo and instructions how to use it in your pages
Sorting with behaviors