Skip to content
This repository was archived by the owner on Feb 2, 2025. It is now read-only.

Commit f4a5598

Browse files
committed
Adding if to validate if user send or no the list of columns
1 parent 4276da6 commit f4a5598

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

src/angular-datatables.directive.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -77,11 +77,13 @@ export class DataTableDirective implements OnDestroy, OnInit {
7777
}
7878

7979
// Set a column unique
80-
resolvedDTOptions.columns.forEach(col => {
81-
if ((col.id ?? '').trim() === '') {
82-
col.id = this.getColumnUniqueId();
83-
}
84-
});
80+
if (resolvedDTOptions.columns) {
81+
resolvedDTOptions.columns.forEach(col => {
82+
if ((col.id ?? '').trim() === '') {
83+
col.id = this.getColumnUniqueId();
84+
}
85+
});
86+
}
8587

8688
// Using setTimeout as a "hack" to be "part" of NgZone
8789
setTimeout(() => {

0 commit comments

Comments
 (0)