:: Forum >>

Numeric sorting with comma as decimal separator

I do not seem to be able to sort properly a column with numeric content where the decimal separator is a comma.
Any idea ?

Example current sort :

544,222
8296,42
830,748

Should be :

544,222
830,748
8296,42
Erwin
Tuesday, May 27, 2008
You should make a custom format object which will convert the text to the proper numeric values. The default implementation -

obj.textToValue = function(v){
return Number(("" + v).replace(numPattern, ""));
};

var numPattern = /[^0-9.\-+]+/gm;

- fails when decimal separator is a comma.
Alex (ActiveWidgets)
Tuesday, May 27, 2008

This topic is archived.


Back to support forum

Forum search