Tablesorter demo
All options included, as well as the uitheme widget
by Mottie
HTML
<script src="http://mottie.github.com/tablesorter/js/jquery.tablesorter.js"></script>
<link rel="stylesheet" href="http://mottie.github.com/tablesorter/css/blue/style.css">
<table class="tablesorter">
<thead>
<tr>
<th>Last Name</th>
<th>Discount</th>
<th>Date</th>
</tr>
</thead>
<tbody>
<tr>
<td><div>Parker</div></td>
<td><a href="#">20%</a></td>
<td><u>Jul 6, 2006 8:14 AM</u></td>
</tr>
<tr>
<td><div>Jones</div></td>
<td><a href="#">25%</a></td>
<td><u>Dec 10, 2002 5:14 AM</u></td>
</tr>
<tr>
<td><div>Smith</div></td>
<td><a href="#">44%</a></td>
<td><u>Jan 12, 2003 11:14 AM</u></td>
</tr>
<tr>
<td><div>Edwards</div></td>
<td><a href="#">44%</a></td>
<td><u>Jan 18, 2001 9:12 AM</u></td>
</tr>
<tr>
<td><div>Evans</div></td>
<td><a href="#">11%</a></td>
<td><u>Jan 18, 2007 9:12 AM</u></td>
</tr>
</tbody>
</table>
JavaScript
$('table').tablesorter({
// include zeba widgets
widgets: ['zebra'],
// initial sort
sortList: [[0, 0], [2, 0]]
});
$('table').bind('sortBegin', function(e, tbl) {
var c = tbl.config,
list = c.sortList;
// add date sort if not the initial sort, otherwise sort second column
// (zero based index)
list.push((list[0] && list[0][0] !== 2) ? [2, 0] : [1, 0]);
});