Buttons not appearing with esbuild/bulma/rails

Buttons not appearing with esbuild/bulma/rails

ttmrozttmroz Posts: 2Questions: 1Answers: 0

Following this thread, https://datatables.net/forums/discussion/comment/201478/#Comment_201478, I was able to successfully install the bulimia version of DataTables and ColReorder and they are working. Thank you!

I can't get the Buttons to appear. The Buttons() are loading from datatables.net-buttons-bm, as outlined in the post cited above. I can see the

<

div class="dt-buttons"> is created. However it is empty. If I drill down into dataTables.buttons.js, and I set config.hasOwnProperty('html') in the _buildButton method to false, I can see a button on the rendered page. So I know things are loaded properly. The config for my table is:

document.addEventListener('DOMContentLoaded', function () {
    let table = new DataTable('#tableid',{
            colReorder: true,
            dom: 'Bfrtip',
            buttons: true
    });       
  });    

What am I doing wrong? I've also tried settings the buttons: config parameter to every combination of the array ['copy', 'excel', 'pdf'].

Thanks for any help.

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 63,125Questions: 1Answers: 10,398 Site admin
    Answer ✓

    Have you loaded in the buttons.html5.js file? With that the Copy button at least should appear. For Excel export you'll need JSZip and for PDF export you'll need pdfmake on your page as well.

    Allan

  • ttmrozttmroz Posts: 2Questions: 1Answers: 0

    Thank you so much! That was the problem. For anyone finding this message and having a similar problem, I was able to load the html5 button using these statements:

    import buttonsHtml5 from 'datatables.net-buttons/js/buttons.html5.js'
    buttonsHtml5(window, $)

Sign In or Register to comment.