frequency decoder ~ Unobtrusive Table Sort Script (revisited)

My first free Sunday morning in what seems like an epoch produces a complete rewrite of the original (and by far most popular) lab experiment, the “Unobtrusive Table Sort Script”, that addresses speed issues present within version #1.


I was getting ready to write a script in PHP that allowed the user to sort a table returned from MySQL, but then Googled instead. Obviously finding or rolling an AJAX object would be a better solution, but you sure can't beat the efficiency of adding this instead.

Demo from the site here.

To add, you just add this to the header of the page:
<script type="text/javascript" src="../path/tablesort.js"></script>
<style>
td {font-size:11px}
th.sort-active {
background:#CAE8EA url(../path/bg_header_sorting.jpg) no-repeat 0 0;
cursor:wait;
}
th.sort-active a {
color:#a80000 !important;
cursor:wait;
}
</style>


Then add class="sortable" to your th and poof! done. Impressively easy, though it'd take a while to make it pretty. The demo shows a good example.