From: Bill Erickson Date: Thu, 5 Aug 2021 15:40:08 +0000 (-0400) Subject: LP1936233 Retain row selection after grid action X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=0ca2bdb68b3237abd964f8c0a8d59413ee34d152;p=working%2FEvergreen.git LP1936233 Retain row selection after grid action Signed-off-by: Bill Erickson --- diff --git a/Open-ILS/src/eg2/src/app/staff/cat/item/status.component.ts b/Open-ILS/src/eg2/src/app/staff/cat/item/status.component.ts index f4032a73d1..3be53f38ad 100644 --- a/Open-ILS/src/eg2/src/app/staff/cat/item/status.component.ts +++ b/Open-ILS/src/eg2/src/app/staff/cat/item/status.component.ts @@ -205,6 +205,9 @@ export class ItemStatusComponent implements OnInit, AfterViewInit { } this.itemService.scannedItems.forEach((item, idx) => { if (item.id() === updatedCopy.id()) { + // Retain the original grid index value so row + // selection can persist. + updatedCopy._index = item._index; this.itemService.scannedItems.splice(idx, 1, updatedCopy); } }); @@ -316,6 +319,8 @@ export class ItemStatusComponent implements OnInit, AfterViewInit { }); } + // In fetchOnly mode, item data is fetched but not added directly to + // the grid. getItemById(id: number, fetchOnly?: boolean): Promise { const flesh = { @@ -341,9 +346,9 @@ export class ItemStatusComponent implements OnInit, AfterViewInit { .toPromise().then(item => { this.mungeIsbns(item); this.selectInput(); - item._index = ItemStatusComponent.rowIndex++; if (!fetchOnly) { + item._index = ItemStatusComponent.rowIndex++; if (this.tab === 'list') { this.itemService.scannedItems.unshift(item); } else { @@ -358,10 +363,9 @@ export class ItemStatusComponent implements OnInit, AfterViewInit { } return this.getItemCirc(item).then(_ => { - if (this.grid) { + if (this.grid && !fetchOnly) { this.grid.reload(); } - return item; }); });