Buttons: Cannot read properties of undefined (reading 'defaults')

Buttons: Cannot read properties of undefined (reading 'defaults')

plotekplotek Posts: 1Questions: 1Answers: 0
edited March 2022 in Free community support

Hi,

I've problem with buttons-bs4. I use Webpack/Encore. My code looks like this:

import $ from 'jquery';
import 'datatables.net-bs4/js/dataTables.bootstrap4'
import 'datatables.net-bs4/css/dataTables.bootstrap4.css'
import 'datatables.net-buttons/js/dataTables.buttons'
import 'datatables.net-buttons-bs4/js/buttons.bootstrap4'
import 'datatables.net-buttons-bs4/css/buttons.bootstrap4.css'
import 'datatables.net-buttons/js/buttons.colVis'
import 'datatables.net-buttons/js/buttons.html5'
import 'datatables.net-buttons/js/buttons.flash'
import 'datatables.net-buttons/js/buttons.print'

When I try initialize DataTable I got error

Uncaught TypeError: Cannot read properties of undefined (reading 'defaults')
    at buttons.bootstrap4.js:38:1
    at Object.<anonymous> (buttons.bootstrap4.js:9:1)
    at buttons.bootstrap4.js:10:4
    at Object../node_modules/datatables.net-buttons-bs4/js/buttons.bootstrap4.js (buttons.bootstrap4.js:34:2)
    at __webpack_require__ (bootstrap:19:1)
    at Module../node_modules/@symfony/stimulus-bridge/lazy-controller-loader.js!./assets/controllers/datatables_controller.js (controllers.json:2:2)
    at __webpack_require__ (bootstrap:19:1)
    at webpackContext (\.[jt]sx:8:1)
    at definitionForModuleWithContextAndKey (index.js:16:1)
    at index.js:10:1

Answers

  • colincolin Posts: 15,240Questions: 1Answers: 2,599

    You also need to include the base DataTables package, that appear to be missing from your list.

    Colin

Sign In or Register to comment.