Skip to content

Commit d0b08c8

Browse files
fix(disable-row): allow disabling through side effects without mutating row data (#40)
1 parent 91dec3d commit d0b08c8

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

projects/ngx-datatable/src/lib/components/body/body-row-wrapper.component.ts

+5-4
Original file line numberDiff line numberDiff line change
@@ -110,13 +110,14 @@ export class DataTableRowWrapperComponent implements DoCheck, OnInit {
110110
}
111111

112112
ngDoCheck(): void {
113+
if (this.disableCheck) {
114+
const isRowDisabled = this.disableCheck(this.row);
115+
this.disable$.next(isRowDisabled);
116+
this.cd.markForCheck();
117+
}
113118
if (this.rowDiffer.diff(this.row)) {
114119
this.rowContext.row = this.row;
115120
this.groupContext.group = this.row;
116-
if (this.disableCheck) {
117-
const isRowDisabled = this.disableCheck(this.row);
118-
this.disable$.next(isRowDisabled);
119-
}
120121
this.cd.markForCheck();
121122
}
122123
}

projects/ngx-datatable/src/lib/components/datatable.component.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -829,7 +829,7 @@ export class DatatableComponent implements OnInit, DoCheck, AfterViewInit, After
829829
* Lifecycle hook that is called when Angular dirty checks a directive.
830830
*/
831831
ngDoCheck(): void {
832-
if (this.rowDiffer.diff(this.rows)) {
832+
if (this.rowDiffer.diff(this.rows) || this.disableRowCheck) {
833833
if (!this.externalSorting) {
834834
this.sortInternalRows();
835835
} else {

0 commit comments

Comments
 (0)