I can't make buttons in jQuery datatables work. I have react app created with create-react-app
import React from 'react';
import $ from 'jquery';
// eslint-disable-next-line
import dt from 'datatables.net';
// eslint-disable-next-line
import buttons from 'datatables.net-buttons';
export default (Child, tableId) =>
class extends React.Component {
componentDidMount = () => {
$(`#${tableId}`).DataTable({
ordering: true,
info: false,
pageLength: 10,
responsive: true,
dom: '<"buttons"B>lTfgitp',
buttons: [ 'csv', 'excel', 'pdf' ]
});
};
render = () => <Child {...this.props} />;
};
and the whole source to run locally
I've noticed that when I put worng button in configuration: buttons: [ 'csv', 'excel', 'pdf', 'foobar' ]
i have error in console 'Uncaught Unknown button type: foobar'
So I gess something is working, but I still can't see buttons.