【问题标题】:jquery.tablesorter.js > sorting mixed-type columnsjquery.tablesorter.js > 对混合类型的列进行排序
【发布时间】:2009-10-23 14:18:58
【问题描述】:

我有一张表,其中有一列是剩余天数。此列中的值可以是数字,也可以是“待定”(待定)。 tablesorter 插件无法正确处理此混合类型列的排序。我怎样才能让它正常工作?

谢谢, ~jk

【问题讨论】:

    标签: jquery jquery-plugins tablesorter


    【解决方案1】:

    您需要创建自己的解析器

    我不确定这是否可行,但尝试搜索 tablesorter 和 addParser 应该会很好:

    jQuery.tablesorter.addParser({
      id: "SpecialNumber",
      is: function(s) {
       return /^TBD/.test(s);
      },
      format: function(s) {
       return 0;
      },
      type: "numeric"
     });
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-02-15
      • 2012-11-07
      • 1970-01-01
      • 2021-02-10
      • 2011-12-18
      • 2011-02-10
      • 2014-06-22
      • 1970-01-01
      相关资源
      最近更新 更多