jQuery Tablesorter - column not sorting alphabetically
Posted
by McGirl
on Stack Overflow
See other posts from Stack Overflow
or by McGirl
Published on 2010-06-14T20:25:30Z
Indexed on
2010/06/14
20:32 UTC
Read the original article
Hit count: 329
jQuery
|tablesorter
I'm not sure what's going wrong here. This is the page: http://www.utexas.edu/ssw/cswr/projects/project-list/
The first column sorts, but it isn't returning data in the correct order (alphabetical).
The table itself is being generated by a custom PHP function that pulls info from a WordPress database. I thought that might be the issue, but as you can see the fourth column (End Date) sorts correctly. I also thought it might be the links in the first column that were messing things up, but adding the text-extraction code from this page broke the sorting altogether.
This is the jQuery code I'm current using to call Tablesorter:
<script type="text/javascript" id="js">
jQuery(document).ready(function($) {
$(document).ready(function() {
// call the tablesorter plugin, the magic happens in the markup
$("#projectTable").tablesorter({
// pass the headers argument and assing a object
//debug: true,
//sortList: [[0,0]],
headers: {
0: {
// set the column to sort as text
sorter: 'text',
},
// assign the secound column (we start counting zero)
1: {
// disable it by setting the property sorter to false
sorter: false,
},
// assign the third column (we start counting zero)
2: {
// disable it by setting the property sorter to false
sorter: false
},
3: {
sorter:'digit'
}
}
});
// Works only with plugin modification
$("#projectTable").bind("sortStart",function(e) {
if( $(e.target).hasClass('header') ) {
$("#overlay").show();
}
}).bind("sortEnd",function(e) {
if( $(e.target).hasClass('header') ) {
$("#overlay").hide();
}
});
});
});
</script>
Thanks for your help!
© Stack Overflow or respective owner