From: Bill Erickson Date: Fri, 14 Aug 2020 19:06:29 +0000 (-0400) Subject: LP1891699 AngJS grid column picker sorting X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=b0b830f84309461b421a5b0aa6e86d2768bf0218;p=working%2FEvergreen.git LP1891699 AngJS grid column picker sorting AngularJS grid column picker displays colums in the following order: 1. Visible colums first, sorted alphabetically. 2. Non-visible columns second, sorted alphabetically. Signed-off-by: Bill Erickson --- diff --git a/Open-ILS/src/templates/staff/share/t_autogrid.tt2 b/Open-ILS/src/templates/staff/share/t_autogrid.tt2 index 38e9a00313..5cbc5fb901 100644 --- a/Open-ILS/src/templates/staff/share/t_autogrid.tt2 +++ b/Open-ILS/src/templates/staff/share/t_autogrid.tt2 @@ -202,7 +202,7 @@ [% l('Print Full Grid') %] -
  • +
  • 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 ce84caa657..c5a638d4a7 100644 --- a/Open-ILS/web/js/ui/default/staff/services/grid.js +++ b/Open-ILS/web/js/ui/default/staff/services/grid.js @@ -372,6 +372,22 @@ angular.module('egGridMod', grid.controls = controls; } + // Visible columns sorted alphabetically followed by + // non-visible columns sorted. + $scope.columnsForPicker = function() { + if (!$scope.columns) { return []; } + + var visible = $scope.columns + .filter(function(c) { return c.visible; }); + var invisible = $scope.columns + .filter(function(c) { return !c.visible; }); + + visible.sort(function(a, b) { return a.label < b.label ? -1 : 1; }); + invisible.sort(function(a, b) { return a.label < b.label ? -1 : 1; }); + + return visible.concat(invisible); + } + // If a menu item provides its own HTML template, translate it, // using the menu item for the template scope. // note: $sce is required to avoid security restrictions and