diff --git a/libs/angular-accelerator/src/lib/components/data-table/data-table.component.html b/libs/angular-accelerator/src/lib/components/data-table/data-table.component.html index 6295aa5c..ab3e25aa 100644 --- a/libs/angular-accelerator/src/lib/components/data-table/data-table.component.html +++ b/libs/angular-accelerator/src/lib/components/data-table/data-table.component.html @@ -122,6 +122,7 @@ scrollHeight="flex" [style]="tableStyle" paginatorDropdownAppendTo="body" + [rowSelectable]="rowSelectable" tableStyleClass="h-full" > @@ -233,7 +234,7 @@ diff --git a/libs/angular-accelerator/src/lib/components/data-table/data-table.component.ts b/libs/angular-accelerator/src/lib/components/data-table/data-table.component.ts index 3b5ff884..4f227972 100644 --- a/libs/angular-accelerator/src/lib/components/data-table/data-table.component.ts +++ b/libs/angular-accelerator/src/lib/components/data-table/data-table.component.ts @@ -422,6 +422,7 @@ export class DataTableComponent extends DataSortBase implements OnInit, AfterCon ) ) ) + this.rowSelectable = this.rowSelectable.bind(this) } ngOnInit(): void { @@ -670,6 +671,14 @@ export class DataTableComponent extends DataSortBase implements OnInit, AfterCon ) } + isRowSelectionDisabled(rowObject: Row) { + return !!this.selectionEnabledField && !this.fieldIsTruthy(rowObject, this.selectionEnabledField) + } + + rowSelectable(event: any) { + return !this.isRowSelectionDisabled(event.data) + } + onSelectionChange(selection: Row[]) { let newSelectionIds = selection.map((row) => row.id) const rows = this._rows$.getValue()