LP#1879335: (follow-up) tweak sorting of bib list
authorGalen Charlton <gmc@equinoxinitiative.org>
Wed, 9 Sep 2020 18:23:55 +0000 (14:23 -0400)
committerGalen Charlton <gmc@equinoxinitiative.org>
Fri, 11 Sep 2020 13:58:52 +0000 (09:58 -0400)
Make sorting the list by bib ID work, but also disable sorting
by title and author since that's not supported without surgery on
the grid data source.

Signed-off-by: Galen Charlton <gmc@equinoxinitiative.org>
Signed-off-by: Bill Erickson <berickxx@gmail.com>
Signed-off-by: Galen Charlton <gmc@equinoxinitiative.org>
Open-ILS/src/eg2/src/app/staff/cat/authority/manage.component.ts
Open-ILS/src/eg2/src/app/staff/share/bib-list/bib-list.component.html

index d4bd0eb..2f626ed 100644 (file)
@@ -52,9 +52,13 @@ export class ManageAuthorityComponent implements OnInit {
     }
 
     getLinkedBibIds(pager: Pager, sort: any): Promise<number[]> {
+        const orderBy: any = {};
+        if (sort.length && sort[0].name === 'id') {
+            orderBy.abl = 'bib ' + sort[0].dir;
+        }
         return this.pcrud.search('abl',
             {authority: this.authId},
-            {limit: pager.limit, offset: pager.offset},
+            {limit: pager.limit, offset: pager.offset, order_by: orderBy},
             {atomic: true}
         ).pipe(map(links => links.map(l => l.bib()))
         ).toPromise();
index 6c0ffca..2ff90f9 100644 (file)
@@ -5,11 +5,11 @@
   </a>
 </ng-template>
 
-<eg-grid #grid [dataSource]="dataSource" idlClass="rmsr" [sortable]="true"
+<eg-grid #grid [dataSource]="dataSource" idlClass="rmsr" [sortable]="false"
   [cellTextGenerator]="cellTextGenerator" [persistKey]="gridPersistKey"
   [showDeclaredFieldsOnly]="true">
 
-  <eg-grid-column name="id" label="ID" i18n-label flex="1"></eg-grid-column>
+  <eg-grid-column name="id" label="ID" i18n-label flex="1" [sortable]="true"></eg-grid-column>
 
   <eg-grid-column name="title" [cellTemplate]="titleTemplate"
     label="Title" i18n-label flex="3"></eg-grid-column>