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>
}
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();
</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>