From ce167bba2c3924335025fc6d50d3c49ab18e9c2f Mon Sep 17 00:00:00 2001 From: LeoMorgan113 Date: Fri, 10 Oct 2025 11:12:15 +0300 Subject: [PATCH] Fix for filtering entity and alarm tables --- .../alarm/alarms-table-widget.component.ts | 20 +++++++++---------- .../entity/entities-table-widget.component.ts | 20 +++++++++---------- 2 files changed, 20 insertions(+), 20 deletions(-) diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/alarm/alarms-table-widget.component.ts b/ui-ngx/src/app/modules/home/components/widget/lib/alarm/alarms-table-widget.component.ts index f0a52ea923..bea4e9b6df 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/alarm/alarms-table-widget.component.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/alarm/alarms-table-widget.component.ts @@ -328,18 +328,18 @@ export class AlarmsTableWidgetComponent extends PageComponent implements OnInit, this.updateData(); }); - this.ctx.aliasController?.filtersChanged.pipe( - takeUntil(this.destroy$) - ).subscribe((filters) => { - let currentFilterId = this.ctx.datasources?.[0]?.filterId; - if (this.displayPagination && currentFilterId && filters.includes(currentFilterId)) { - this.paginator.pageIndex = 0; - } - this.updateData(); - }); - if (this.displayPagination) { this.sort.sortChange.pipe(takeUntil(this.destroy$)).subscribe(() => this.paginator.pageIndex = 0); + + this.ctx.aliasController?.filtersChanged.pipe( + takeUntil(this.destroy$) + ).subscribe((filters) => { + let currentFilterId = this.ctx.defaultSubscription.options.alarmSource?.filterId; + if (currentFilterId && filters.includes(currentFilterId)) { + this.paginator.pageIndex = 0; + } + this.updateData(); + }); } ((this.displayPagination ? merge(this.sort.sortChange, this.paginator.page) : this.sort.sortChange) as Observable).pipe( takeUntil(this.destroy$) diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/entity/entities-table-widget.component.ts b/ui-ngx/src/app/modules/home/components/widget/lib/entity/entities-table-widget.component.ts index 0feda80f60..2420faac43 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/entity/entities-table-widget.component.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/entity/entities-table-widget.component.ts @@ -263,18 +263,18 @@ export class EntitiesTableWidgetComponent extends PageComponent implements OnIni this.updateData(); }); - this.ctx.aliasController?.filtersChanged.pipe( - takeUntil(this.destroy$) - ).subscribe((filters) => { - let currentFilterId = this.ctx.datasources?.[0]?.filterId; - if (this.displayPagination && currentFilterId && filters.includes(currentFilterId)) { - this.paginator.pageIndex = 0; - } - this.updateData(); - }); - if (this.displayPagination) { this.sort.sortChange.pipe(takeUntil(this.destroy$)).subscribe(() => this.paginator.pageIndex = 0); + + this.ctx.aliasController?.filtersChanged.pipe( + takeUntil(this.destroy$) + ).subscribe((filters) => { + let currentFilterId = this.ctx.defaultSubscription.options.datasources?.[0]?.filterId; + if (currentFilterId && filters.includes(currentFilterId)) { + this.paginator.pageIndex = 0; + } + this.updateData(); + }); } ((this.displayPagination ? merge(this.sort.sortChange, this.paginator.page) : this.sort.sortChange) as Observable).pipe( takeUntil(this.destroy$)