jquery table sorter sort issues
Good evening all,
I'm trying to implement jquery table sorter, all seems fine and sorts by columns, however for some reason the date (default) column doesn't sort by the date format I'm using. This is the code:
<script type="text/javascript">
$(document).ready(function()
{
$("#myTable").tablesorter( {sortList: [[0,0]]} );
}
);
</script>
The date column is the first column and the dates are written in this format: 2 June 11 15 October 11 etc
In addition, from the above code, how would you disable the option 开发者_开发技巧to sort a particular column (column 6, which is the final column)? Can't for the life of me figure it out!
Failing this, I'm more than happy to use the date format as dd/mm/yyyy if it's easier?
try this to disable sorting on 6th header:
$("#myTable").tablesorter({
sortList: [[0,0]],
// pass the headers argument
headers: {
// assign the sixth column (we start counting zero)
5: {
// this is header 6 since the headers start at 0
// disable it by setting the property sorter to false
sorter: false
},
}
});
see here for doc on this option
to sort those types of dates you might have to make your own sorting implementation because tablesorter
doesn't know what a date
is (in that format)
so you can add a date parser, as explained in the doc.
精彩评论