To recover numeric (vs. ascii-betical) sorting of number and money
values in grids, cast the cached sort values back into numbers.
This was tested in the billing interface, but should repair numeric
sorting for most grids.
Signed-off-by: Bill Erickson <berick@esilibrary.com>
Signed-off-by: Jason Etheridge <jason@esilibrary.com>
Signed-off-by: Ben Shum <bshum@biblio.org>
if (a.sort_value) {
a = a.sort_value;
b = b.sort_value;
+
+ // ensure that numeric values have not
+ // morphed into strings along the way.
+ if (obj.columns[p].sort_type == 'money' ||
+ obj.columns[p].sort_type == 'number') {
+ a = Number(a);
+ b = Number(b);
+ }
} else {
a = a.value;
b = b.value;