I am looking to save a selected set of rows from a table. The saveAs function is giving me this Error: Uncaught ReferenceError: JSZip is not defined I have the FileSaver.js, I even updated it as in .js/blob/master/FileSaver.js
Can someone help me on what is wrong with this ? What could I do differently to have the rows exported to excel? I am using param query
{
type: 'button',
label: "Export",
icon: "ui-icon-arrowthickstop-1-s",
listener: function () {
//filter the selected rows.
this.filter({
oper: 'replace',
data: [{ dataIndx: 'Selected', value: true, condition: 'equal' }]
})
Blob = this.exportData({
format: $("#export_format").val(),
zip: $("#export_zip").prop("checked"),
render: true
});
//reset the filter.
this.filter({
oper: 'replace',
data: []
})
if (typeof blob === "string") {
blob = new Blob([blob]);
}
saveAs(blob, "RollManager." + format);
}
}
I am looking to save a selected set of rows from a table. The saveAs function is giving me this Error: Uncaught ReferenceError: JSZip is not defined I have the FileSaver.js, I even updated it as in https://github./eligrey/FileSaver.js/blob/master/FileSaver.js
Can someone help me on what is wrong with this ? What could I do differently to have the rows exported to excel? I am using param query
{
type: 'button',
label: "Export",
icon: "ui-icon-arrowthickstop-1-s",
listener: function () {
//filter the selected rows.
this.filter({
oper: 'replace',
data: [{ dataIndx: 'Selected', value: true, condition: 'equal' }]
})
Blob = this.exportData({
format: $("#export_format").val(),
zip: $("#export_zip").prop("checked"),
render: true
});
//reset the filter.
this.filter({
oper: 'replace',
data: []
})
if (typeof blob === "string") {
blob = new Blob([blob]);
}
saveAs(blob, "RollManager." + format);
}
}
Share
Improve this question
asked Apr 11, 2017 at 21:20
ForeverLearnerForeverLearner
1891 gold badge4 silver badges12 bronze badges
2 Answers
Reset to default 3You have to include JSZip script. It should be in your Paramquery files e.g. "/jsZip-2.5.0/jszip.min.js" like this
<script type="text/javascript" src="[path to paramquery]/jsZip-2.5.0/jszip.min.js"></script>
To import jszip in js, use require
like this.
require(['<path-to js>/jszip'], function (JSZip) {
console.log(JSZip);
});
Pass JSZip
wherever it is used.