jquery tablesorter错误地排序数字

时间:2010-06-16 00:49:07

标签: jquery tablesorter

我的表格中有一列数字排序不正确。

Example numbers:
5.8
2.4
10.7
0.1
1.9

基本上我的问题是10.7应该在最后/非常开始,这取决于它的排序方式。但它出现在中间。

2 个答案:

答案 0 :(得分:1)

尝试手动指定列解析器。您可以通过元数据轻松完成此操作 - 指示相关列的表标题类中的解析器类型。例如:

<th class="{sorter: 'floating'}">

进一步阅读:

答案 1 :(得分:0)

请参阅Ken的回答,但请注意,较新版本中不再存在“浮动”(并且'整数'也不存在)。您现在需要使用'数字'

ts.addParser({
  id: "digit",
  is: function (s, table) {
    var c = table.config;
    return $.tablesorter.isDigit(s, c);
  }, format: function (s) {
    return $.tablesorter.formatFloat(s);
  }, type: "numeric"
});
相关问题