function ts_sort_numeric(a,b) {
var aa = ts_getInnerText(a.cells[SORT_COLUMN_INDEX]);
aa = clean_num(aa);
var bb = ts_getInnerText(b.cells[SORT_COLUMN_INDEX]);
bb = clean_num(bb);
return compare_numeric(aa,bb);
}
function compare_numeric(a,b) {
var a = parseFloat(a);
a = (isNaN(a) ? 0 : a);
var b = parseFloat(b);
b = (isNaN(b) ? 0 : b);
return a - b;
}
我使用上面的代码。我的问题是,如果我根据数值对表格进行排序,它的排序方式如1,10,11,12,13...19,100,101,2,20,21
等,但我需要1,2,3,4,5..