ExcelHtml5 button not showing after upgrading from buttons 1.1.2 to 1.2.1

ExcelHtml5 button not showing after upgrading from buttons 1.1.2 to 1.2.1

FairenFairen Posts: 3Questions: 1Answers: 0
edited July 2016 in Free community support

Hello, first i want to thank you for all the work you do/have done on datatables it's a great tool !

I'm having some issues since i upgraded datatables.net-buttons from 1.1.2 to 1.2.1.

buttons: [
    'colvis', 
    {
        extend : 'excelHtml5',
        text : 'Export Excel',
        title : generateTitleDoc()
    }
],

In fact the excelhtml5 button is not showing anymore, the test (available() method) which is called when the page load to check if the browser support the html export button return false (on chorme). After some investigation, it seems that the issue is due to :

if ( jsZip === undefined ) {
    jsZip = window.JSZip;
}

(button.html5.js line 44)

window.JSZip is undefined when this is called despite that i refer jsZip in my bower.json and that in can access it through the console.

"dependencies": {
    ...
    "jquery": "~2.1.3",
    ...
    "jszip": "2.5.0",
    "datatables.net": "1.10.12",
    "datatables.net-bs": "1.10.12",
    "datatables.net-colreorder": "~1.3.0",
    "datatables.net-colreorder-bs": "~1.3.0",
    "datatables.net-buttons": "1.2.1",
    "datatables.net-buttons-bs": "1.2.1",
    "datatables.net-select": "1.1.0",
    "datatables.net-select-bs": "1.1.0",
    ....
  },

(bower.json)

I don't find any thread about that issue exept the one about this commit :
https://github.com/DataTables/Buttons/commit/f497837a9b57e20bb4d8a8fd6a11a5f010f4a89f

If you have some ideas, any help would be apreciated.
Nevertheless, thank again on your work on this library :)

Regards,
Mathieu.

This question has an accepted answers - jump to answer

Answers

  • rogerarogera Posts: 9Questions: 2Answers: 1
    Answer ✓

    I had the same issue. I changed the order of loading the javascripts, making sure that JsZip was before Datatables scripts. Then it worked. Probably enough to have JsZip loaded before the Buttons script but I made it load also before Datatables main script.

    Try this and hopefully it will work!
    Regards
    /Roger

  • FairenFairen Posts: 3Questions: 1Answers: 0

    Hi Roger, thank you for your answer.

    I was suspected this too, but my js is concatenated before being used in the app. I'll look for a way to force the order in the Gruntfile.js.

    Regards,
    Mathieu.

  • allanallan Posts: 62,327Questions: 1Answers: 10,227 Site admin

    This has come up a few times - I think I'm going to make a change in Buttons so the load order is irrelevant. That should be in the next release (next couple of days).

    Allan

  • FairenFairen Posts: 3Questions: 1Answers: 0

    I fixed the issue by concatenating the jsZip.js first in my gruntfile.js and it works.

    Thanks for your input.
    Regards,

    Mathieu.

This discussion has been closed.