jQuery tablesorter plugin and dates
Posted in jquery on September 21st, 2009 by paul – Be the first to commentI recently discovered the exellent tablesorter jquery plugin for sorting tables of data. It works very well and saved a lot of time having to write server side sorting code.
I did hit a small snag with dates of the format “12 Aug 2008″. The default sorter seemed to be sorting on the day part of the date and ignoring everything else.
In the end I had to set the sorter for these columns as the isoDate sorter which works perfectly, once I set the dateFormat to “uk”.
eg
<script type="text/javascript" charset="utf-8">
$(document).ready(function()
{
$("#pupils_table").tablesorter({
headers: {
4: {
sorter:'isoDate'
}
},
dateFormat: "uk"
});
}
);
</script>