开发者

jquery.tablesorter.js > sorting mixed-type columns

I have a table that has a column for Days Remaining. The values in this column are either a number, or 'TBD' (to be determined). The tablesorte开发者_如何学Pythonr plugin doesn't properly handle the sorting of this mixed-type column. How could I get this to work properly?

Thanks, ~jk


You need to create your own parser

I am not sure this will work, but try searching for tablesorter and addParser and you should be good:

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

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜