LP1670457 Action Menu Grid Selection Change user/zbanks/lp1670457-action-menu-grid-selection
authorZavier Banks <zbanks@catalyte.io>
Thu, 5 Mar 2020 16:19:49 +0000 (16:19 +0000)
committerZavier Banks <zbanks@catalyte.io>
Thu, 5 Mar 2020 16:19:49 +0000 (16:19 +0000)
I reworked the grid to disable certain actions, if
an item was needed. However, if there were actions, were
there was no item needed, they would still be available.

Signed-off-by: Zavier Banks <zbanks@catalyte.io>
Open-ILS/src/templates/staff/share/t_autogrid.tt2
Open-ILS/web/js/ui/default/staff/services/grid.js

index c872c76..5415455 100644 (file)
@@ -92,8 +92,7 @@
 
     <!-- actions drop-down menu -->
     <div class="btn-group" ng-show="showActions" ng-if="actionGroups.length > 1 || actionGroups[0].actions.length" uib-dropdown>                                                  
-      <button type="button" class="btn btn-default" uib-dropdown-toggle
-        ng-disabled="!hasSelected()">
+      <button type="button" class="btn btn-default" uib-dropdown-toggle>
         [% l('Actions') %] <span class="caret"></span>                       
       </button>                                                              
       <ul class="pull-right grid-action-dropdown scrollable-menu" uib-dropdown-menu>
index 6224cb9..660fba8 100644 (file)
@@ -654,6 +654,9 @@ angular.module('egGridMod',
 
             // fires the disable handler function for a context action
             $scope.actionDisable = function(action) {
+                if(grid.getSelectedItems().length == 0 && action.handler.length > 0) {
+                    return true;
+                }
                 if (typeof action.disabled == 'undefined') {
                     return false;
                 }