From b2bcf2d020dd5d8d90223fa9198faafea7edd6f7 Mon Sep 17 00:00:00 2001 From: Galen Charlton Date: Thu, 25 Mar 2021 13:44:44 -0400 Subject: [PATCH] LP#1904244: teach grid columns how to start with a filter set This adds initialFilterOperator and initialFilterValue inputs to eg-grid-column to specify that the data set should start off with a column filter set. Signed-off-by: Galen Charlton Signed-off-by: Ruth Frasur Signed-off-by: Bill Erickson --- Open-ILS/src/eg2/src/app/share/grid/grid-column.component.ts | 6 ++++++ .../src/eg2/src/app/share/grid/grid-filter-control.component.ts | 6 +++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/Open-ILS/src/eg2/src/app/share/grid/grid-column.component.ts b/Open-ILS/src/eg2/src/app/share/grid/grid-column.component.ts index 1556d31d49..38220605c5 100644 --- a/Open-ILS/src/eg2/src/app/share/grid/grid-column.component.ts +++ b/Open-ILS/src/eg2/src/app/share/grid/grid-column.component.ts @@ -30,6 +30,10 @@ export class GridColumnComponent implements OnInit { // result filtering @Input() filterable: boolean; + // optional initial filter values + @Input() initialFilterOperator: string; + @Input() initialFilterValue: string; + // Display date and time when datatype = timestamp @Input() datePlusTime: boolean; @@ -66,6 +70,8 @@ export class GridColumnComponent implements OnInit { col.disableTooltip = this.disableTooltip; col.isSortable = this.sortable; col.isFilterable = this.filterable; + col.filterOperator = this.initialFilterOperator; + col.filterValue = this.initialFilterValue; col.isMultiSortable = this.multiSortable; col.datatype = this.datatype; col.datePlusTime = this.datePlusTime; diff --git a/Open-ILS/src/eg2/src/app/share/grid/grid-filter-control.component.ts b/Open-ILS/src/eg2/src/app/share/grid/grid-filter-control.component.ts index 36fcfae73f..e5add56623 100644 --- a/Open-ILS/src/eg2/src/app/share/grid/grid-filter-control.component.ts +++ b/Open-ILS/src/eg2/src/app/share/grid/grid-filter-control.component.ts @@ -33,7 +33,11 @@ export class GridFilterControlComponent implements OnInit { private org: OrgService ) {} - ngOnInit() { } + ngOnInit() { + if (this.col.filterValue !== undefined) { + this.applyFilter(this.col); + } + } operatorChanged(col: GridColumn) { if (col.filterOperator === 'null' || col.filterOperator === 'not null') { -- 2.11.0