From: Bill Erickson Date: Tue, 13 Aug 2013 14:12:28 +0000 (-0400) Subject: LP1211506 fix numeric sorting in staff client grids X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=refs%2Fheads%2Fuser%2Fberick%2Flp1211506-bill-ui-money-sorting;p=working%2FEvergreen.git 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 --- 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 ]; }