From a4c08ff8e62c7166921e74dc374073fd3180123c Mon Sep 17 00:00:00 2001 From: Florent Poittevin <florent.poittevin@unige.ch> Date: Wed, 29 Jan 2020 12:55:07 +0100 Subject: [PATCH] fix: data table isFilterApplied and ClearFilters --- .../shared-data-table/shared-data-table.presentational.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/app/shared/components/presentationals/shared-data-table/shared-data-table.presentational.ts b/src/app/shared/components/presentationals/shared-data-table/shared-data-table.presentational.ts index 0287313e7..2f40c6a9d 100644 --- a/src/app/shared/components/presentationals/shared-data-table/shared-data-table.presentational.ts +++ b/src/app/shared/components/presentationals/shared-data-table/shared-data-table.presentational.ts @@ -256,7 +256,7 @@ export class SharedDataTablePresentational<TResource extends BaseResource> exten isFilterApplied(): boolean { let toSkip: boolean = false; - if (this._queryParameters.search.searchItems.size !== 0) { + if (MappingObjectUtil.size(QueryParametersUtil.getSearchItems(this.queryParameters)) > 0) { if (this.columnsSkippedToClear === undefined || isEmptyArray(this.columnsSkippedToClear)) { return true; } @@ -272,11 +272,11 @@ export class SharedDataTablePresentational<TResource extends BaseResource> exten clearFilters(): void { let queryParameters = QueryParametersUtil.clone(this.queryParameters); - const searchItems: Map<string, string> = MappingObjectUtil.toMap(QueryParametersUtil.getSearchItems(queryParameters)); + const searchItems = QueryParametersUtil.getSearchItems(queryParameters); if (this.columnsSkippedToClear === undefined || isEmptyArray(this.columnsSkippedToClear)) { - searchItems.clear(); + MappingObjectUtil.clear(searchItems); } else { - searchItems.forEach((value: string, key: string) => { + MappingObjectUtil.forEach(searchItems, (value: string, key: string) => { if (this.columnsSkippedToClear.some(c => c.includes(key)) === false) { MappingObjectUtil.delete(searchItems, key); } -- GitLab