1
Fork 0

Tablesorter: sort the total score properly. Fixes #1.

master
vonavi 2014-05-21 17:51:45 +03:00
parent 9ecaf82c6a
commit e86a86e4c2
1 changed files with 11 additions and 1 deletions

View File

@ -1,6 +1,16 @@
$(function() {
/* Convert score to numeric number for sorting */
$.tablesorter.addParser({
id: 'score',
format: function(s, table, cell, cellIndex) {
return s.replace(/½/,'.5');
},
type: 'numeric'
});
/* Sort a tournament table with tablesorter */
$('.tablesorter .opponent').addClass('{sorter: false}');
$('.tablesorter th.score').data('sorter', false);
$('.tablesorter th.total').data('sorter', 'score');
$('.tablesorter').tablesorter({
theme : 'blue',
widgets : ['zebra'],