disable Edit Selected action unless exactly one row is selected
authorJason Etheridge <jason@EquinoxOLI.org>
Wed, 14 Dec 2022 22:28:13 +0000 (17:28 -0500)
committerJason Etheridge <jason@EquinoxOLI.org>
Wed, 14 Dec 2022 22:28:13 +0000 (17:28 -0500)
Signed-off-by: Jason Etheridge <jason@EquinoxOLI.org>
Open-ILS/src/eg2/src/app/staff/admin/local/circ_matrix_matchpoint/circ-matrix-matchpoint.component.html
Open-ILS/src/eg2/src/app/staff/admin/local/circ_matrix_matchpoint/circ-matrix-matchpoint.component.ts

index c8d1cd1..887f7c0 100644 (file)
   <eg-grid-toolbar-button 
     label="New Circ Matrix Matchpoint" i18n-label (onClick)="createNew()">
   </eg-grid-toolbar-button>
-  <eg-grid-toolbar-action label="Edit Selected" i18n-label (onClick)="editSelected($event)">
+  <eg-grid-toolbar-action
+    label="Edit Selected" i18n-label
+    (onClick)="editSelected($event)"
+    [disableOnRows]="notOneSelectedRow">
   </eg-grid-toolbar-action>
 </eg-grid>
 
index f2a8501..d3c2b1e 100644 (file)
@@ -27,6 +27,7 @@ export class CircMatrixMatchpointComponent implements OnInit {
         marginTop: '25px',
         marginLeft: '73%'
     };
+    notOneSelectedRow: (rows: IdlObject[]) => boolean;
 
     @ViewChild('limitSets', { static: false }) limitSets: ElementRef;
     @ViewChild('circLimitSets', { static: true }) limitSetsComponent: LinkedCircLimitSetsComponent;
@@ -70,6 +71,7 @@ export class CircMatrixMatchpointComponent implements OnInit {
             };
             return this.pcrud.retrieveAll('ccmm', searchOps, {fleshSelectors: true});
         };
+        this.notOneSelectedRow = (rows: IdlObject[]) => (rows.length !== 1);
     }
 
     clearLinkedCircLimitSets() {