From acfc0fda748f5d09e692db39ba7c5a744e1cf8af Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Thu, 10 Sep 2020 11:04:15 -0400 Subject: [PATCH] LP1879335 Tweak bib-list sorting continued Teach the bib-list component to honor the sort specification when fetching its records. In cases where IDs are sorted externally (via bibIdSource), this ensures the records retrieved from those IDs are also similarly sorted. Signed-off-by: Bill Erickson Signed-off-by: Galen Charlton --- .../src/app/staff/share/bib-list/bib-list.component.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/Open-ILS/src/eg2/src/app/staff/share/bib-list/bib-list.component.ts b/Open-ILS/src/eg2/src/app/staff/share/bib-list/bib-list.component.ts index 5cacc8e4ff..49fe1d8fd8 100644 --- a/Open-ILS/src/eg2/src/app/staff/share/bib-list/bib-list.component.ts +++ b/Open-ILS/src/eg2/src/app/staff/share/bib-list/bib-list.component.ts @@ -69,12 +69,20 @@ export class BibListComponent implements OnInit { return empty(); } + // ID is the currently only supported sort column. If other + // columns are added, callers providing a bibIdSource will need + // to implement the new columns as well. + const orderBy = {rmsr: 'id'}; + if (sort.length && sort[0].name === 'id') { + orderBy.rmsr = orderBy.rmsr + ' ' + sort[0].dir; + } + return from(promise).pipe(switchMap(bibIds => { if (bibIds.length === 0) { return empty(); } return this.pcrud.search('rmsr', {id: bibIds}, { - order_by: {rmsr: 'id'}, + order_by: orderBy, flesh: 2, flesh_fields: { rmsr: ['biblio_record'], -- 2.43.2