This is a migrated thread and some comments may be shown as answers.

Kendo Export: JSZip and AMD

1 Answer 1136 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Michael
Top achievements
Rank 1
Michael asked on 28 Jul 2015, 08:28 AM

When exporting a Datagrid to Excel, Kendo requires JSZip. However kendo assumes JSZip is a global which is not true when loaded in an AMD environment as JSZip does not export a global. Therefore I propose to at least use a call to require in case JSZip has already been loaded (kendo.ooxml.js, line 593):  

toDataURL: function () {
                var JSZip = window.JSZip;
                if (typeof JSZip === "undefined") {
                    if (define && define.amd) {
                        JSZip = require('jszip');
                    }
                    else
                        throw new Error("JSZip not found. Check http://docs.telerik.com/kendo-ui/framework/excel/introduction#requirements for more details.");
                }
 
                var zip = new JSZip();
...
}


Even better was of course a true asynchronous loading:

require(['jszip'], function (JSZip) {     ...      })

1 Answer, 1 is accepted

Sort by
0
T. Tsonev
Telerik team
answered on 30 Jul 2015, 11:44 AM
Hello,

Thanks for your suggestion. I'll discuss it with the team and implement it if possible.

For the moment, our official recommendation is to require jszip in advance.

Regards,
T. Tsonev
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
Tags
Grid
Asked by
Michael
Top achievements
Rank 1
Answers by
T. Tsonev
Telerik team
Share this question
or