Buttons appear to be breaking my DataTable

Buttons appear to be breaking my DataTable

sjw01sjw01 Posts: 67Questions: 36Answers: 1

I followed the guide on the site and tried to add buttons for exporting data as follows:

    buttons: [
        'copy', 'csv', 'excel', 'pdf', 'print'
    ],

http://live.datatables.net/lidequra/1/edit

This didn't work.

I then went back and saw the buttons package in the download section and added the Buttons package, HTML5 export and created a new CDN hosted download which I added to the demo above.

Problem is - Not only does it not display the buttons, it breaks everything and doesn't throw any errors. The icon click toggle no longer works - basically all javascript is disabled but there are no errors in the console.

If you uncomment swap the DataTables CDN include files in the HTML example comment/uncomment - it all works but no buttons...

This question has accepted answers - jump to:

Answers

  • sjw01sjw01 Posts: 67Questions: 36Answers: 1

    NOTE:
    Table works ok with original css/js includes which were just DataTables and Responsive
    Table stops working properly when I add Buttons and HTML5 Export to DataTables and Responsive.
    I have added B to dom which completely breaks it - removing B at least shows the table but the Javascript click toggle doesn't respond

  • allanallan Posts: 63,075Questions: 1Answers: 10,384 Site admin
    Answer ✓

    If you have a look at your browser's console it says:

    Uncaught Unknown button type: print

    That is because the print button hasn't been loaded, but it was referenced. You need to either include the print file (an option in the download builder) or remove it from the list of buttons.

    Allan

  • colincolin Posts: 15,237Questions: 1Answers: 2,598

    Yep, I had to remove that button when I made that example for your other thread. This example here shows what files you want if you want to add them in manually.

    C

  • sjw01sjw01 Posts: 67Questions: 36Answers: 1
    edited May 2018

    Something so simple... Damn it!

    I've fixed it now and can see print & csv BUT the excel button isn't showing?

    JS Includes:
    * DataTables v1.10.16
    * Buttons v1.5.1
    * Flash export v1.5.1
    * HTML5 export v1.5.1
    * Responsive v2.2.1

  • sjw01sjw01 Posts: 67Questions: 36Answers: 1
    edited May 2018

    Looks like i need JSzip right?
    https://stuk.github.io/jszip/

    Yep... Installed and working

    Thanks

  • sjw01sjw01 Posts: 67Questions: 36Answers: 1

    Is there anyway to override the Filename?

    I don't mind the filename (page title) I just want to add the date

  • colincolin Posts: 15,237Questions: 1Answers: 2,598
    Answer ✓

    Yep, if you look at this example here, it uses the filename option to change the name.

    C

This discussion has been closed.