Jquery sort table number
667 ワード
So here is what the column is sorted as:
4,666
141,666
293
341,666
346
461,676
This should be sorted as
293
346
4,666
141,666
341,666
461,676
4,666
141,666
293
341,666
346
461,676
This should be sorted as
293
346
4,666
141,666
341,666
461,676
$(document).ready(function() {
$.tablesorter.addParser({
id: 'fancyNumber',
is:function(s){return false;},
format: function(s) {return s.replace(/[\,\.]/g,'');},
type: 'numeric'
});
$("table").tablesorter({headers: {0: {sorter: 'fancyNumber'}}});
});