Skip to content

Commit

Permalink
Sort on table cell text rather than html
Browse files Browse the repository at this point in the history
It's confusing to sort on something other than what is seen
and bizarre to sort on, for example, the href attribute.
  • Loading branch information
rwstauner committed Jun 17, 2014
1 parent 2f7df32 commit 9e48075
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions root/static/js/cpan.js
Expand Up @@ -99,15 +99,15 @@ $(document).ready(function () {

$('#signin-button').mouseenter(function () { $('#signin').show() });
$('#signin').mouseleave(function () { $('#signin').hide() });

$('table.tablesorter').each(function(){
var sortid = (localStorage.getItem("tablesorter:"+ this.id) ||
this.getAttribute('data-default-sort') || '0,0');
sortid = JSON.parse("[" + sortid + "]");
$(this).tablesorter({sortList: [sortid], widgets: ['zebra'], textExtraction: function (node) {
var $node = $(node);
var sort = $node.attr("sort");
if(!sort) return node.innerHTML;
if(!sort) return $node.text();
if ($node.hasClass("date")) {
return (new Date(sort)).getTime();
} else {
Expand Down

0 comments on commit 9e48075

Please sign in to comment.