When using the Bootstrap integration for DataTables, I see the following error in the console:
Uncaught TypeError: Cannot read property 'defaults' of undefined (dataTables.bootstrap.js:20)
This causes the pagination controls to not have styles on them.
I can see that in the factory initialization, the following code needs to run:
factory( jQuery, jQuery.fn.dataTable );
However, jQuery.fn.dataTable
is returning undefined
.
I got the same error, I'm using laravel 5.4 with webpack, here package.json before:
I had to move
jquery
anddatatables.net
npm packages under one of these"dependencies": {}
or"devDependencies": {}
inpackage.json
and the error disappeared, after:I hope that helps!
The problem is that
dataTable
is not defined at the point you are calling this method.Ensure that you are loading the
.js
files in the correct order: