From e19f99e9ad6a1bac6e9f846160daf60f7ac5eded Mon Sep 17 00:00:00 2001 From: Maksym Tsymbarov Date: Mon, 9 Feb 2026 17:33:44 +0200 Subject: [PATCH] Fixed state change of "Select all" checkbox in attributes table --- .../attribute/attribute-table.component.html | 2 +- .../attribute/attribute-table.component.ts | 12 +++++++++++- .../home/models/datasource/attribute-datasource.ts | 6 ++++-- 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/ui-ngx/src/app/modules/home/components/attribute/attribute-table.component.html b/ui-ngx/src/app/modules/home/components/attribute/attribute-table.component.html index 6a797a37aa..c9247f5549 100644 --- a/ui-ngx/src/app/modules/home/components/attribute/attribute-table.component.html +++ b/ui-ngx/src/app/modules/home/components/attribute/attribute-table.component.html @@ -142,7 +142,7 @@ diff --git a/ui-ngx/src/app/modules/home/components/attribute/attribute-table.component.ts b/ui-ngx/src/app/modules/home/components/attribute/attribute-table.component.ts index 9187b69b73..b26eee40cf 100644 --- a/ui-ngx/src/app/modules/home/components/attribute/attribute-table.component.ts +++ b/ui-ngx/src/app/modules/home/components/attribute/attribute-table.component.ts @@ -40,7 +40,7 @@ import { MatDialog } from '@angular/material/dialog'; import { DialogService } from '@core/services/dialog.service'; import { Direction, SortOrder } from '@shared/models/page/sort-order'; import { forkJoin, merge, Observable, Subject } from 'rxjs'; -import { debounceTime, distinctUntilChanged, takeUntil } from 'rxjs/operators'; +import { debounceTime, distinctUntilChanged, take, takeUntil } from 'rxjs/operators'; import { EntityId } from '@shared/models/id/entity-id'; import { AttributeData, @@ -187,6 +187,7 @@ export class AttributeTableComponent extends PageComponent implements AfterViewI textSearch = this.fb.control('', {nonNullable: true}); private destroy$ = new Subject(); + selectAllModel: boolean = false; constructor(protected store: Store, private attributeService: AttributeService, @@ -223,6 +224,14 @@ export class AttributeTableComponent extends PageComponent implements AfterViewI }); }); this.widgetResize$.observe(this.elementRef.nativeElement); + + this.dataSource.selection.changed.pipe( + takeUntil(this.destroy$) + ).subscribe(() => { + this.dataSource.isAllSelected().pipe(take(1)).subscribe(allSelected => { + this.selectAllModel = allSelected; + }); + }); } ngOnDestroy() { @@ -237,6 +246,7 @@ export class AttributeTableComponent extends PageComponent implements AfterViewI this.attributeScope = attributeScope; this.mode = 'default'; this.paginator.pageIndex = 0; + this.selectAllModel = false; this.updateData(true); } diff --git a/ui-ngx/src/app/modules/home/models/datasource/attribute-datasource.ts b/ui-ngx/src/app/modules/home/models/datasource/attribute-datasource.ts index eaeade89ae..cc3112442f 100644 --- a/ui-ngx/src/app/modules/home/models/datasource/attribute-datasource.ts +++ b/ui-ngx/src/app/modules/home/models/datasource/attribute-datasource.ts @@ -115,9 +115,11 @@ export class AttributeDatasource implements DataSource { } isAllSelected(): Observable { - const numSelected = this.selection.selected.length; return this.attributesSubject.pipe( - map((attributes) => numSelected === attributes.length) + map((attributes) => { + const numSelected = this.selection.selected.length; + return attributes.length > 0 && numSelected === attributes.length + }) ); }