ITeye博客

Jquery sort table number

夜鸣猪 · 2013-03-19 01:01 · javascript Jquery sort plugin 插件 · Ruby On Rails · 编程语言 · Markdown

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
$(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'}}});
});

评论(0)

暂无评论。

评论功能维护中,当前仅展示历史评论。