0
我有一個價格字段和總金額字段: 價格字段的值爲0.9999900或0.9000000總金額可以是10,000.00或1,000,000.00。我正在使用tablesorter庫來排序表。tablesorter格式化數字之間用逗號和數字之間的問題沒有他們
問題是,如果我設置就像下面(罰款總額排序作品)
s=s.replace(new RegExp(/[^0-9\/A-Za-z ]/g),"");
如果我設置就像下面(價格排序工作正常)
s=s.replace(new RegExp(/[^0-9\/A-Za-z. ]/g),"");
,但我不能同時獲得在同一時間到工作..我在想什麼:
ts.addParser({
id: "digit",
is: function(s,table) {
var c = table.config;
s=s.replace(new RegExp(/[^0-9\/A-Za-z ]/g),"");
return $.tablesorter.isDigit(s,c);
},
format: function(s) {
return $.tablesorter.formatFloat(s.replace(new RegExp(/[^0-9\/A-Za-z ]/g),""));
},
type: "numeric"
});