From cd8a16b1faaaad1791bfcbe4f450c832fb1b9dc5 Mon Sep 17 00:00:00 2001 From: markuczy Date: Wed, 13 Nov 2024 12:49:44 +0100 Subject: [PATCH] fix: filter options computed correctly --- .../data-table/data-table.component.html | 68 ++++++++++--------- .../data-table/data-table.component.ts | 10 ++- 2 files changed, 43 insertions(+), 35 deletions(-) diff --git a/libs/angular-accelerator/src/lib/components/data-table/data-table.component.html b/libs/angular-accelerator/src/lib/components/data-table/data-table.component.html index 21b584e0..a0d1cc7f 100644 --- a/libs/angular-accelerator/src/lib/components/data-table/data-table.component.html +++ b/libs/angular-accelerator/src/lib/components/data-table/data-table.component.html @@ -149,42 +149,44 @@ [title]="(sortIconTitle(column.id) | translate)" [attr.aria-label]="('OCX_DATA_TABLE.TOGGLE_BUTTON.ARIA_LABEL' | translate: { column: (column.nameKey | translate), direction: (sortDirectionToTitle(columnNextSortDirection(column.id)) | translate)})" > - - -
-
- - + + +
+
+ + - - -
+ > +
+
+
+ | undefined currentFilterColumn$ = new BehaviorSubject(null) - currentEqualFilterOptions$: Observable | undefined + currentEqualFilterOptions$: Observable<{ options: SelectItem[]; column: DataTableColumn | undefined }> | undefined currentEqualSelectedFilters$: Observable | undefined truthyFilterOptions = [ { @@ -459,7 +459,7 @@ export class DataTableComponent extends DataSortBase implements OnInit, AfterCon ), mergeMap(([rows, currentFilterColumn, filters]) => { if (!currentFilterColumn?.id) { - return of([]) + return of({ options: [], column: undefined }) } const currentFilters = filters @@ -487,6 +487,12 @@ export class DataTableComponent extends DataSortBase implements OnInit, AfterCon value: filterOption, }) as SelectItem ) + }), + map((options) => { + return { + options: options, + column: currentFilterColumn, + } }) ) })