diff --git a/src/app/common/table/columns/selection/asy-selection-column.component.ts b/src/app/common/table/columns/selection/asy-selection-column.component.ts index 45960666..3fbeed42 100644 --- a/src/app/common/table/columns/selection/asy-selection-column.component.ts +++ b/src/app/common/table/columns/selection/asy-selection-column.component.ts @@ -37,7 +37,7 @@ export class AsySelectionColumnComponent { readonly #destroyRef = inject(DestroyRef); #dataSource: AsyTableDataSource; - #selectionModel: SelectionModel; + #selectionModel = new SelectionModel(); readonly enableSelectAll = input(true, { transform: booleanAttribute }); readonly clearOnLoad = input(true, { transform: booleanAttribute }); @@ -57,7 +57,11 @@ export class AsySelectionColumnComponent override ngOnInit(): void { super.ngOnInit(); - this.#selectionModel = new SelectionModel(this.multi()); + if (this.multi()) { + const selection = this.#selectionModel.selected; + this.#selectionModel = new SelectionModel(this.multi()); + this.#selectionModel.select(...selection); + } if (this._isAsyTableDataSource(this._table.dataSource)) { this.#dataSource = this._table.dataSource;