Browse Source

Fix for filtering entity and alarm tables

pull/14134/head
LeoMorgan113 11 months ago
parent
commit
ce167bba2c
  1. 20
      ui-ngx/src/app/modules/home/components/widget/lib/alarm/alarms-table-widget.component.ts
  2. 20
      ui-ngx/src/app/modules/home/components/widget/lib/entity/entities-table-widget.component.ts

20
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.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) { if (this.displayPagination) {
this.sort.sortChange.pipe(takeUntil(this.destroy$)).subscribe(() => this.paginator.pageIndex = 0); 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<any>).pipe( ((this.displayPagination ? merge(this.sort.sortChange, this.paginator.page) : this.sort.sortChange) as Observable<any>).pipe(
takeUntil(this.destroy$) takeUntil(this.destroy$)

20
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.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) { if (this.displayPagination) {
this.sort.sortChange.pipe(takeUntil(this.destroy$)).subscribe(() => this.paginator.pageIndex = 0); 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<any>).pipe( ((this.displayPagination ? merge(this.sort.sortChange, this.paginator.page) : this.sort.sortChange) as Observable<any>).pipe(
takeUntil(this.destroy$) takeUntil(this.destroy$)

Loading…
Cancel
Save