TableSort最新版如何支持中文汉字排序

Capricornph 2016-04-24 10:44:00
最新版本链接:http://mottie.github.io/tablesorter/docs/index.html#Download
用完发现不支持中文排序,求修改支持方法。
...全文
251 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
Capricornph 2016-04-25
  • 打赏
  • 举报
回复
但是当当列同时有中文跟英文的时候 英文会默认排到中文前面,怎么破
Go 旅城通票 2016-04-24
  • 打赏
  • 举报
回复
有textSorter配置,配置这个就好了,中文需要使用localeCompare,不能a>b这样比 参考:jQuery.tablesorter 2.0中文排序解决办法
    $("table").tablesorter({
        theme: 'blue', textSorter: function (a, b, asc, table) {
            return a.localeCompare(b);
        }
    });

87,909

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 JavaScript
社区管理员
  • JavaScript
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧