Skip to content

Commit

Permalink
fix error when data table pagination is disabled (#151)
Browse files Browse the repository at this point in the history
* fix error when data table pagination is disabled

* fix error when data table pagination is disabled

---------

Co-authored-by: Daniel Wagner <[email protected]>
  • Loading branch information
Wagei and Wagei authored Nov 29, 2023
1 parent eae1466 commit e57fc76
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,9 @@ export class DataTableComponent implements OnInit, AfterViewInit {
}

setFilterValue(value: string): void {
this.dataSource.filter = value?.trim().toLowerCase();
if (this.dataSource) {
this.dataSource.filter = value?.trim().toLowerCase();
}
}

onRowEvent(event: MouseEvent, row: any, action = this.defaultAction): void {
Expand Down Expand Up @@ -494,7 +496,7 @@ export class DataTableComponent implements OnInit, AfterViewInit {

private unsetPageSizeIfNecessary() {
if (!this.useAsync && !this.isPaginationEnabled) {
const dataCount = this.dataSource.data ? this.dataSource.data.length : 0;
const dataCount = this.dataSource?.data ? this.dataSource.data.length : 0;
this.paginatorPageSize = dataCount;
this.paginatorLength = dataCount;
}
Expand Down

0 comments on commit e57fc76

Please sign in to comment.