TableExport icon indicating copy to clipboard operation
TableExport copied to clipboard

saveAs is not a function

Open ehdwns980416 opened this issue 8 years ago • 0 comments
trafficstars

@clarketm Thank you for made a great plugin.

But when I use this plugin, I've got some error. I tried to export table to .xlsx file.

ERROR TypeError: saveAs is not a function
    at TableExport.export2file (eval at webpackJsonp.../../../../script-loader/addScript.js.module.exports (addScript.js:9), <anonymous>:726:21)
    at TableExport.downloadHandler (eval at webpackJsonp.../../../../script-loader/addScript.js.module.exports (addScript.js:9), <anonymous>:688:22)
    at ZoneDelegate.webpackJsonp.../../../../zone.js/dist/zone.js.ZoneDelegate.invokeTask (zone.js:425)
    at Object.onInvokeTask (core.es5.js:3881)
    at ZoneDelegate.webpackJsonp.../../../../zone.js/dist/zone.js.ZoneDelegate.invokeTask (zone.js:424)
    at Zone.webpackJsonp.../../../../zone.js/dist/zone.js.Zone.runTask (zone.js:192)
    at ZoneTask.webpackJsonp.../../../../zone.js/dist/zone.js.ZoneTask.invokeTask [as invoke] (zone.js:499)
    at invokeTask (zone.js:1427)
    at HTMLButtonElement.globalZoneAwareCallback (zone.js:1445)

this error is what i got.

And I tried to find what is the error. So I opened plugin source. (tableexport.js) I did some test in here. And I got something wrong.

That line is 34 line.

root.TableExport = factory(root.jQuery, root.Blob, root.saveAs, root.XLSX);

I realized root.saveAs is undefined when start this plugin. So I think TypeError: saveAs is not a function occured at line 721.

saveAs(new Blob([data],
                        {type: mime + ';' + this.charset}),
                        name + extension, true);

What should I do?

ehdwns980416 avatar Oct 13 '17 15:10 ehdwns980416