valuechanges user/sandbergja/ng_manage_authorities
authorJane Sandberg <sandbej@linnbenton.edu>
Sun, 11 Aug 2019 14:59:35 +0000 (07:59 -0700)
committerJane Sandberg <sandbej@linnbenton.edu>
Sun, 11 Aug 2019 14:59:35 +0000 (07:59 -0700)
Open-ILS/src/eg2/src/app/staff/cat/authorities/manage.component.html
Open-ILS/src/eg2/src/app/staff/cat/authorities/manage.component.ts

index 3fd775b..a501919 100644 (file)
@@ -6,8 +6,8 @@
     </eg-combobox-entry>
   </eg-combobox>
 </form>
-{{field}}
-<eg-grid #grid [dataSource]="gridSource"
+{{field | json}}
+<eg-grid #authoritiesGrid [dataSource]="gridSource"
   persistKey="cat.authorities.manage">
   <eg-grid-column path="record.id" label="ID" i18n-label [index]="true" [hidden]="true"></eg-grid-column>
   <eg-grid-column path="sort_value" label="Sort value" i18n-label></eg-grid-column>
index 57edd83..6f69db0 100644 (file)
@@ -1,9 +1,11 @@
+import { GridComponent } from '@eg/share/grid/grid.component';
 import {FormGroup, FormControl} from '@angular/forms';
 import {PcrudService} from '@eg/core/pcrud.service';
-import {Component} from '@angular/core';
+import {Component, ViewChild} from '@angular/core';
 import {GridDataSource} from '@eg/share/grid/grid';
 import {Pager} from '@eg/share/util/pager';
 import { IdlObject } from '@eg/core/idl.service';
+import { of } from 'rxjs';
 
 @Component({
   templateUrl: './manage.component.html',
@@ -12,6 +14,7 @@ export class ManageAuthoritiesComponent {
     gridSource: GridDataSource;
     search: FormGroup;
     authorityFields: IdlObject[] = [];
+    @ViewChild('authoritiesGrid') authoritiesGrid: GridComponent;
 
     constructor(
         private pcrud: PcrudService
@@ -20,6 +23,10 @@ export class ManageAuthoritiesComponent {
             field: new FormControl()
         });
 
+        this.field.valueChanges.subscribe(
+            () => this.authoritiesGrid.reload()
+        );
+
         this.pcrud.search('acsaf', {'main_entry': null})
         .subscribe((field) => this.authorityFields.push(field));
 
@@ -38,6 +45,8 @@ export class ManageAuthoritiesComponent {
                         ash: ['record']
                     }
                 });
+            } else {
+                return of();
             }
         };
     }