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

Commit a174da2

Browse files
committed
fix: workaround for spread operator as it triggers rollup's 'this is undefined' error
1 parent 1718e7e commit a174da2

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/angular-datatables.directive.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,8 @@ export class DataTableDirective implements OnDestroy, OnInit {
6363
Promise.resolve(this.dtOptions).then(dtOptions => {
6464
// Using setTimeout as a "hack" to be "part" of NgZone
6565
setTimeout(() => {
66-
this.dt = $(this.el.nativeElement).DataTable({
67-
...dtOptions,
66+
// Assign DT properties here
67+
let options: ADTSettings = {
6868
rowCallback: (row, data, index) => {
6969
if (dtOptions.columns) {
7070
const columns = dtOptions.columns;
@@ -90,7 +90,10 @@ export class DataTableDirective implements OnDestroy, OnInit {
9090
this.dtOptions.rowCallback(row, data, index);
9191
}
9292
}
93-
});
93+
};
94+
// merge user's config with ours
95+
options = Object.assign({}, dtOptions, options);
96+
this.dt = $(this.el.nativeElement).DataTable(options);
9497
resolve(this.dt);
9598
});
9699
});

0 commit comments

Comments
 (0)