无法使用 jQuery 表格排序器对日期模式 'yyyy-MM-dd hh:mm:ss.SSS' 进行排序。我也尝试了以下解析器
ts.addParser({
id: "customDate",
is: function (s) {
//return false;
//use the above line if you don't want table sorter to auto detected this parser //else use the below line.
//attention: doesn't check for invalid stuff
//2009-77-77 77:77:77.000 would also be matched
//if that doesn't suit you alter the regex to be more restrictive
return /\d{1,4}-\d{1,2}-\d{1,2} \d{1,2}:\d{1,2}:\d{1,2}.\d{1,3}/.test(s);
},
format: function (s) {
s = s.replace(/\-/g, " ");
s = s.replace(/:/g, " ");
s = s.replace(/\./g, " ");
s = s.split(" ");
return $.tablesorter.formatFloat(new Date(s[0], s[1] - 1, s[2], s[3], s[4], s[5], s[6]).getTime() + parseInt(s[7]));
},
type: "numeric"
});
提前致谢。