From 6f7277e56ed56558483af7818f39939c10f1317c Mon Sep 17 00:00:00 2001 From: Mike Rylander Date: Mon, 22 Sep 2014 12:03:48 -0400 Subject: [PATCH] LP#1402797 Push explicitly added columns to the top and keep the explicit order, then sort the rest by their labels Signed-off-by: Mike Rylander 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 2dca40999a..9dc5b7d851 100644 --- a/Open-ILS/web/js/ui/default/staff/services/grid.js +++ b/Open-ILS/web/js/ui/default/staff/services/grid.js @@ -1039,6 +1039,15 @@ angular.module('egGridMod', {idl_field : field, idl_class : class_obj}); }); + cols.columns = cols.columns.sort( + function(a, b) { + if (a.explicit) return -1; + if (b.explicit) return 1; + return a.label < b.label ? -1 : 1; + } + ); + + } else { console.error( "egGrid: wildcard path does not resolve to an object: " @@ -1090,6 +1099,8 @@ angular.module('egGridMod', if (column.path && column.path.match(/\*$/)) return cols.expandPath(colSpec); + if (!fromExpand) column.explicit = true; + if (!column.name) column.name = column.path; if (!column.path) column.path = column.name; -- 2.11.0