From 5da17488e1f5097eae6e3a51d3e56db464110a53 Mon Sep 17 00:00:00 2001 From: "a. bellenir" Date: Tue, 7 Aug 2018 18:18:41 -0400 Subject: [PATCH] LP1785333 - right-click can clear grid selection use a more gooder strategy for determining item's index in $scope.selected Signed-off-by: a. bellenir --- Open-ILS/web/js/ui/default/staff/services/grid.js | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) 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 4c2ff19d87..9dcdc5fb38 100644 --- a/Open-ILS/web/js/ui/default/staff/services/grid.js +++ b/Open-ILS/web/js/ui/default/staff/services/grid.js @@ -681,7 +681,7 @@ angular.module('egGridMod', if (!$scope.menu_dom) $scope.menu_dom = $($scope.grid_element).find('.grid-action-dropdown')[0]; if (!$scope.action_context_parent) $scope.action_context_parent = $($scope.menu_dom).parent(); - // we need the index of the row that got right-clicked... + // we need the the row that got right-clicked... var e = $event.target; // the DOM element var s = undefined; // the angular scope for that element while(e){ // searching for the row so we can get its index from s.$index @@ -691,13 +691,8 @@ angular.module('egGridMod', if(s.hasOwnProperty('item')){ break; } e = e.parentElement; } - /* $scope.items and $scope.selected indexes are "backwards" to each other. - $scope.items counts down from the top of the list (most recent item first) - $scope.selected counts forward as items are scanned (most recent item last) - s.$index is for $scope.items. we need the index for $scope.selected: */ - var selectable_index = ($scope.items.length-1) - s.$index; // select the right-clicked row if it is not already selected (lp1776557): - if(!$scope.selected[selectable_index]){ $event.target.click(); } + if(!$scope.selected[grid.indexValue(s.item)]){ $event.target.click(); } if (!$scope.action_context_showing) { $scope.action_context_width = $($scope.menu_dom).css('width'); -- 2.11.0