From 1fc37ba2715922da2a076b2c7e968fb924a2ff61 Mon Sep 17 00:00:00 2001 From: Jason Etheridge Date: Wed, 6 Apr 2022 17:04:16 -0400 Subject: [PATCH] LP1857910 make field doc grid sortable/pageable Signed-off-by: Jason Etheridge Signed-off-by: Jane Sandberg --- .../field-documentation.component.html | 2 +- .../field-documentation.component.ts | 23 ++++++++++++++++------ 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/Open-ILS/src/eg2/src/app/staff/admin/local/field-documentation/field-documentation.component.html b/Open-ILS/src/eg2/src/app/staff/admin/local/field-documentation/field-documentation.component.html index c6ee7bb973..25474a7e70 100644 --- a/Open-ILS/src/eg2/src/app/staff/admin/local/field-documentation/field-documentation.component.html +++ b/Open-ILS/src/eg2/src/app/staff/admin/local/field-documentation/field-documentation.component.html @@ -19,7 +19,7 @@
+ persistKey="admin.config.idl_field_doc" idlClass="fdoc" [sortable]="true"> diff --git a/Open-ILS/src/eg2/src/app/staff/admin/local/field-documentation/field-documentation.component.ts b/Open-ILS/src/eg2/src/app/staff/admin/local/field-documentation/field-documentation.component.ts index a8ff1ec95a..664f99080b 100644 --- a/Open-ILS/src/eg2/src/app/staff/admin/local/field-documentation/field-documentation.component.ts +++ b/Open-ILS/src/eg2/src/app/staff/admin/local/field-documentation/field-documentation.component.ts @@ -114,11 +114,22 @@ export class FieldDocumentationComponent implements OnInit { setCurrentFieldDoc() { if (this.selectedClass) { this.fields = this.selectedClass.fields; - this.pcrud.search('fdoc', - {fm_class: this.selectedClass.id} - ).subscribe(fdocs => { - this.gridDataSource.data.push(fdocs); - }); + this.gridDataSource.getRows = (pager: Pager, sort: any[]) => { + const orderBy: any = {}; + if (sort.length) { + // Sort specified from grid + orderBy['fdoc'] = sort[0].name + ' ' + sort[0].dir; + } + + const searchOps = { + fm_class: this.selectedClass.id, + offset: pager.offset, + limit: pager.limit, + order_by: orderBy + }; + return this.pcrud.retrieveAll('fdoc', searchOps, {fleshSelectors: true}); + }; + this.fieldDocGrid.reload(); } } @@ -180,4 +191,4 @@ export class FieldDocumentationComponent implements OnInit { } ); } -} \ No newline at end of file +} -- 2.11.0