From 8fb47d37de56024ddd821324230a31208aa3698e Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Tue, 13 Aug 2013 10:12:28 -0400 Subject: [PATCH] LP1211506 fix numeric sorting in staff client grids 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 --- Open-ILS/xul/staff_client/chrome/content/util/list.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/Open-ILS/xul/staff_client/chrome/content/util/list.js b/Open-ILS/xul/staff_client/chrome/content/util/list.js index d32e557e80..d4e5039b08 100644 --- a/Open-ILS/xul/staff_client/chrome/content/util/list.js +++ b/Open-ILS/xul/staff_client/chrome/content/util/list.js @@ -1781,12 +1781,18 @@ util.list.prototype = { } rows = rows.sort( function(A,B) { function normalize(a,b,p) { - /* 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; if (obj.columns[p].sort_type) { @@ -1818,7 +1824,7 @@ util.list.prototype = { b = String( b ).toUpperCase(); } } - //} + } return [ a, b ]; } -- 2.11.0