A minor change is required in the Excel HTML5 button code to support JSZip 3.0
A minor change is required in the Excel HTML5 button code to support JSZip 3.0
On lines 699-702 (roughly), the _saveAs() call which uses zip.generate() needs to be changed to:
zip.generateAsync({ type: "blob", mimeType: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' }).then(function (blob) { _saveAs(blob, _filename(config));});
The old version doesn't work with JSZip 3.0, as the generate() method has been removed as of that version. I've made this modification in my current project, and verified that it works.
This question has an accepted answers - jump to answer
Answers
I've noticed this too when trying to upgrade JSZip but didn't think much of staying at 2.x for the time being.
Feel free to make the change to the plugin itself and make a contribution to the source code: https://github.com/DataTables/DataTablesSrc
Thanks for pointing this out! I'll take a look at what is involved in ensure it is compatible with both JSZip 2 and 3 and post back here when done.
Allan
I've committed the required change and Buttons 1.2.0 will support JSZip 3. I've also retained support for 2.5 and will continue to use 2.5 on the DataTables download builder at the moment as it does everything I need for the Excel file create and v3 is 22.4K larger than 2.5.
Allan
I was trying this out with Buttons 1.2.2 and jszip 3.1.1 and got the same error as above. Moving to jszip 2.x sorted the issue for now.
I think there have been some more changes in jszip because of which newer version is throwing the same error.
I've just tried using Buttons 1.2.2 and JSZip 3.1.1 here: http://live.datatables.net/bicadume/1/edit . I don't get that error.
Can you give me a link to the page showing the issue please?
Allan