From: Bill Erickson Date: Mon, 17 Dec 2018 22:37:30 +0000 (-0500) Subject: LP1806087 Option to disable grid row selection behavior X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=9ee74c9a98692fd82875062fb0aaba8b40f82539;p=working%2FEvergreen.git LP1806087 Option to disable grid row selection behavior Signed-off-by: Bill Erickson --- diff --git a/Open-ILS/src/eg2/src/app/share/grid/grid-body.component.html b/Open-ILS/src/eg2/src/app/share/grid/grid-body.component.html index b7284fe6f0..8d495aa84d 100644 --- a/Open-ILS/src/eg2/src/app/share/grid/grid-body.component.html +++ b/Open-ILS/src/eg2/src/app/share/grid/grid-body.component.html @@ -6,9 +6,11 @@ [ngClass]="{'selected': context.rowSelector.contains(context.getRowIndex(row))}" *ngFor="let row of context.dataSource.getPageOfRows(context.pager); let idx = index"> -
- -
+ +
+ +
+
{{context.pager.rowNumber(idx)}}
diff --git a/Open-ILS/src/eg2/src/app/share/grid/grid-body.component.ts b/Open-ILS/src/eg2/src/app/share/grid/grid-body.component.ts index e4829cee01..15aa2b7038 100644 --- a/Open-ILS/src/eg2/src/app/share/grid/grid-body.component.ts +++ b/Open-ILS/src/eg2/src/app/share/grid/grid-body.component.ts @@ -50,6 +50,13 @@ export class GridBodyComponent implements OnInit { } onRowClick($event: any, row: any, idx: number) { + + if (this.context.disableSelect) { + // Avoid any appearance or click behavior when row + // selection is disabled. + return; + } + const index = this.context.getRowIndex(row); if (this.context.disableMultiSelect) { diff --git a/Open-ILS/src/eg2/src/app/share/grid/grid-header.component.html b/Open-ILS/src/eg2/src/app/share/grid/grid-header.component.html index 58e0c66774..0662f54b0b 100644 --- a/Open-ILS/src/eg2/src/app/share/grid/grid-header.component.html +++ b/Open-ILS/src/eg2/src/app/share/grid/grid-header.component.html @@ -1,8 +1,10 @@
-
- -
+ +
+ +
+
#
diff --git a/Open-ILS/src/eg2/src/app/share/grid/grid.component.ts b/Open-ILS/src/eg2/src/app/share/grid/grid.component.ts index 1fa4c2cfee..cca8283bb1 100644 --- a/Open-ILS/src/eg2/src/app/share/grid/grid.component.ts +++ b/Open-ILS/src/eg2/src/app/share/grid/grid.component.ts @@ -44,6 +44,8 @@ export class GridComponent implements OnInit, AfterViewInit, OnDestroy { // The value is prefixed with 'eg.grid.' @Input() persistKey: string; + @Input() disableSelect: boolean; + // Prevent selection of multiple rows @Input() disableMultiSelect: boolean; @@ -109,6 +111,7 @@ export class GridComponent implements OnInit, AfterViewInit, OnDestroy { this.context.isSortable = this.sortable === true; this.context.isMultiSortable = this.multiSortable === true; this.context.useLocalSort = this.useLocalSort === true; + this.context.disableSelect = this.disableSelect === true; this.context.disableMultiSelect = this.disableMultiSelect === true; this.context.rowFlairIsEnabled = this.rowFlairIsEnabled === true; this.context.rowFlairCallback = this.rowFlairCallback; diff --git a/Open-ILS/src/eg2/src/app/share/grid/grid.ts b/Open-ILS/src/eg2/src/app/share/grid/grid.ts index e04940dd1a..dd2acdd30c 100644 --- a/Open-ILS/src/eg2/src/app/share/grid/grid.ts +++ b/Open-ILS/src/eg2/src/app/share/grid/grid.ts @@ -421,6 +421,7 @@ export class GridContext { useLocalSort: boolean; persistKey: string; disableMultiSelect: boolean; + disableSelect: boolean; dataSource: GridDataSource; columnSet: GridColumnSet; rowSelector: GridRowSelector;