From 969ae676505fae8be13c211e5a38559b4182495e Mon Sep 17 00:00:00 2001 From: Max Ehrlicher-Schmidt Date: Wed, 16 Dec 2020 17:15:42 +0100 Subject: [PATCH] remove only unsaved filter if no unsaved rows --- src/app/components/table/table.component.ts | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/app/components/table/table.component.ts b/src/app/components/table/table.component.ts index 645a3d0..970e206 100644 --- a/src/app/components/table/table.component.ts +++ b/src/app/components/table/table.component.ts @@ -192,6 +192,13 @@ export class TableComponent implements AfterViewInit { } } this.data.data = tempDataSource; + + setTimeout(() => { + if (this.countUnsavedRows() == 0 && this.filters.onlyUnsaved) { + this.filters.onlyUnsaved = false; + this.applyFilters(); + } + }); }); this.dataService.loadTableData(); @@ -324,6 +331,10 @@ export class TableComponent implements AfterViewInit { deleteNewObject(row: any) { this.data.data = this.data.data.filter((element) => row.id !== element.id); + if (this.countUnsavedRows() == 0 && this.filters.onlyUnsaved) { + this.filters.onlyUnsaved = false; + this.applyFilters(); + } } create(row: any) {