Closed ruelluna closed 2 years ago
Don't forget to import which theme of the datatables.net, example bootstrap4:
import 'datatables.net-bs4'
I believe if you npm install the package above, it automatically include the datatables.net jquery plugin package as dependency so importing that will also import the datatables.net jquery plugin.
i have same problem but if i add \
import 'datatables.net-bs4'
got error
ERROR in ./resources/js/components/Trends.vue?vue&type=script&lang=js& (./node_modules/babel-loader/lib??ref--4-0!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/components/Trends.vue?vue&type=script&lang=js&) Module not found: Error: Can't resolve 'datatables.net-bs4' in 'D:\OSPanel\domains\analytic\resources\js\components' @ ./resources/js/components/Trends.vue?vue&type=script&lang=js& (./node_modules/babel-loader/lib??ref--4-0!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/components/Trends.vue?vue&type=script&lang=js&) 348:0-28 @ ./resources/js/components/Trends.vue?vue&type=script&lang=js& @ ./resources/js/components/Trends.vue @ ./resources/js sync \.vue$/ @ ./resources/js/app.js @ multi ./resources/js/app.js ./resources/sass/app.scss
Did you install it? Is it in your package.json?
npm install datatables.net-bs4
@ruelluna did you manage to solve the problem?
Old issue with no updates.
Had the same issue while working with this in a Laravel app and this solved it for me
The controller.php in the class must contain something like this:
protected function make()
{
parent::make();
$this->tplConfig->addJS([
'dataTables',
...
]);
I am having this error. Can you please tell me what's happening?
vue.common.dev.js?4650:630 [Vue warn]: Error in mounted hook: "TypeError: n.DataTable is not a function"