From bbbc7a80ca45ec675f74e75be226870ddceab1ae Mon Sep 17 00:00:00 2001 From: Dan Wells Date: Thu, 15 Mar 2018 14:52:23 -0400 Subject: [PATCH] LP#1731278 Make webstaff grid column sort stable As Remington Steed deduced, lack of stable sort in Chrome causes our webstaff grid "explicit" columns to move around in the process of sorting the other columns. As a simplistic fix, let's first record the original order, then keep any explicit columns in their original order. Signed-off-by: Dan Wells Signed-off-by: Kathy Lussier --- Open-ILS/web/js/ui/default/staff/services/grid.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/Open-ILS/web/js/ui/default/staff/services/grid.js b/Open-ILS/web/js/ui/default/staff/services/grid.js index 15d61f281d..9d29cc391a 100644 --- a/Open-ILS/web/js/ui/default/staff/services/grid.js +++ b/Open-ILS/web/js/ui/default/staff/services/grid.js @@ -1502,8 +1502,19 @@ angular.module('egGridMod', {idl_parent : idl_parent, idl_field : field, idl_class : class_obj, field_parent_label : old_field_label }); }); + angular.forEach(cols.columns, function(col, i) { + col.origPos = i; + }); cols.columns = cols.columns.sort( function(a, b) { + if (a.explicit && b.explicit) { + if (a.origPos < b.origPos) { + return -1; + } else { + return 1; + } + } + if (a.explicit) return -1; if (b.explicit) return 1; -- 2.11.0