From 1be3d75f9fd8429b84f0b14df8ed08aa473addc7 Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Thu, 9 Nov 2017 11:21:40 -0500 Subject: [PATCH] LP#1730752 Grid colum 'sort visible to top' option Adds a new button to the grid configuration dialog to sort visible columns to the top of the dialog (i.e. the left of the grid). Fix issue where last modified column remained styled after the dialog closes. Signed-off-by: Bill Erickson Signed-off-by: Kathy Lussier --- .../templates/staff/share/t_grid_columns.tt2 | 5 +++++ .../web/js/ui/default/staff/services/grid.js | 19 +++++++++++++++++++ 2 files changed, 24 insertions(+) diff --git a/Open-ILS/src/templates/staff/share/t_grid_columns.tt2 b/Open-ILS/src/templates/staff/share/t_grid_columns.tt2 index 4393446140..5b1cf6afea 100644 --- a/Open-ILS/src/templates/staff/share/t_grid_columns.tt2 +++ b/Open-ILS/src/templates/staff/share/t_grid_columns.tt2 @@ -17,6 +17,11 @@
[% l('Sort Priority') %]
+
+ +
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 e85171dce4..3f7a9dff85 100644 --- a/Open-ILS/web/js/ui/default/staff/services/grid.js +++ b/Open-ILS/web/js/ui/default/staff/services/grid.js @@ -1087,10 +1087,29 @@ angular.module('egGridMod', $dialogScope.modifyColumnPos = $scope.modifyColumnPos; $dialogScope.disableMultiSort = $scope.disableMultiSort; $dialogScope.columns = $scope.columns; + + // Push visible columns to the top of the list + $dialogScope.elevateVisible = function() { + var new_cols = []; + angular.forEach($dialogScope.columns, function(col) { + if (col.visible) new_cols.push(col); + }); + angular.forEach($dialogScope.columns, function(col) { + if (!col.visible) new_cols.push(col); + }); + + // Update all references to the list of columns + $dialogScope.columns = + $scope.columns = + grid.columnsProvider.columns = + new_cols; + } + $dialogScope.toggle = function(col) { col.visible = !Boolean(col.visible); } $dialogScope.ok = $dialogScope.cancel = function() { + delete $scope.lastModColumn; $uibModalInstance.close() } } -- 2.43.2