I was working on the project and suddenly the DataTable started to remain undefined after initialization, well it doesn't initialize itself either for some reason.
This is how I'm using it:
declare var $;
export ClassName implements OnInit {
dataTable: any;
ngOnInit(){
this.dataTable = $('#table').DataTable({
processing: true,
ordering: false,
pageLength: 10,
language: this.getLanguages(),
searching: false,
dom: 't',
paging: true,
columns: comp.getColumns(), // returns columns
createdRow: ( row, data, dataIndex) => {
/* code */
}
});
// code doesn't come here
}
}
The error on the console is;
core.js:5828 ERROR TypeError: Cannot read property 'style' of undefined
at _fnCalculateColumnWidths (datatables.bundle.js:5601)
at _fnInitialise (datatables.bundle.js:4715)
at loadedInit (datatables.bundle.js:1294)
at HTMLTableElement.<anonymous> (datatables.bundle.js:1306)
at Function.each (vendors.bundle.js:1290)
at jQuery.fn.init.each (vendors.bundle.js:1125)
at jQuery.fn.init.DataTable [as dataTable] (datatables.bundle.js:869)
at jQuery.fn.init.$.fn.DataTable (datatables.bundle.js:15123)
at comp.ngOnInit (comp.ts:149)
at callHook (core.js:3892)
I've searched for it on the web but couldn't find an answer to solve my issue. As I told before, this suddenly became an issue without me changing something about the DataTable..
Thanks in advance people.