Skip to content

Commit

Permalink
fix(disable-row): allow disabling through side effects without mutati…
Browse files Browse the repository at this point in the history
…ng row data (#40)
  • Loading branch information
chintankavathia authored Feb 4, 2024
1 parent 91dec3d commit d0b08c8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -110,13 +110,14 @@ export class DataTableRowWrapperComponent implements DoCheck, OnInit {
}

ngDoCheck(): void {
if (this.disableCheck) {
const isRowDisabled = this.disableCheck(this.row);
this.disable$.next(isRowDisabled);
this.cd.markForCheck();
}
if (this.rowDiffer.diff(this.row)) {
this.rowContext.row = this.row;
this.groupContext.group = this.row;
if (this.disableCheck) {
const isRowDisabled = this.disableCheck(this.row);
this.disable$.next(isRowDisabled);
}
this.cd.markForCheck();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -829,7 +829,7 @@ export class DatatableComponent implements OnInit, DoCheck, AfterViewInit, After
* Lifecycle hook that is called when Angular dirty checks a directive.
*/
ngDoCheck(): void {
if (this.rowDiffer.diff(this.rows)) {
if (this.rowDiffer.diff(this.rows) || this.disableRowCheck) {
if (!this.externalSorting) {
this.sortInternalRows();
} else {
Expand Down

0 comments on commit d0b08c8

Please sign in to comment.