【问题标题】:Using JQuery tablesorter with emptyTo to properly sort empty fields将 JQuery 表排序器与 emptyTo 一起使用以正确排序空字段
【发布时间】:2023-03-04 17:43:02
【问题描述】:

我一直在努力让 tablesorter emptyTo 参数正确排序空字段。我想要的是将所有空单元格保留在排序列的底部,我认为这是默认行为。

如何做到这一点的官方描述在这里:https://mottie.github.io/tablesorter/docs/example-option-sort-empty.html

我相信我使用的代码与官方示例非常接近,但我根本无法让它工作。

这是我正在使用的代码:

$(function() 
{ 
    $("#myTable").tablesorter({
        sortList: [[1,1]],
         emptyTo: 'bottom'
                               }); 
}); 

排序顺序参数有效,表格可按列排序,但我无法让空字段表现得像 emptyTo 参数所指示的那样——我已经尝试了所有示例值。

这里有一个测试用例:http://shootredtanks.com/test/award_list.html

【问题讨论】:

    标签: javascript jquery tablesorter


    【解决方案1】:

    您在http://shootredtanks.com/test/award_list.html 中使用的tablesorter 版本较旧(2.0.5b),您需要升级到更高版本来解决此问题。

    使用最新版本http://plnkr.co/edit/rRMWUb2Gj5niy01Ah3wL?p=info 的工作示例(使用您的版本无法正常工作)。

    这个用途:

    /*! TableSorter (FORK) v2.28.4 *//*
    * Client-side table sorting with ease!
    * @requires jQuery v1.2.6+
    

    【讨论】:

    • 谢谢。没有你的帮助,我永远不会发现问题。我从tablesorter.com 下载了tablesorter,正如您所指出的,它的旧版本不再(?)按描述工作。 mottie.github.io/tablesorter/docs/… 有一个更新的版本。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2016-07-30
    • 2013-03-25
    • 1970-01-01
    • 2018-03-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多