我在使用带有a的货币的tablesorter插件时遇到问题 例如:9,789,000.00等 有谁知道这方面的工作? 请不要向我推荐其他图书馆. Tablesorter允许您为这样的事情定义 “custom parsers”. // add parse
例如:9,789,000.00等
有谁知道这方面的工作?
请不要向我推荐其他图书馆.
Tablesorter允许您为这样的事情定义 “custom parsers”.// add parser through the tablesorter addParser method
$.tablesorter.addParser({
// set a unique id
id: 'thousands',
is: function(s) {
// return false so this parser is not auto detected
return false;
},
format: function(s) {
// format your data for normalization
return s.replace('$','').replace(/,/g,'');
},
// set type, either numeric or text
type: 'numeric'
});
$(function() {
$("table").tablesorter({
headers: {
6: {//zero-based column index
sorter:'thousands'
}
}
});
});
您可能需要调整格式函数.
也尝试在页面上搜索,主题已经被讨论了很多次,如here
