Author Topic: JSZip is not a constructor  (Read 4097 times)

[email protected]

  • Newbie
  • *
  • Posts: 1
    • View Profile
JSZip is not a constructor
« on: September 14, 2021, 03:42:30 am »
Hi,
I am evaluating your product and when importing an xlsx I get the following error: "JSZip is not a constructor"

I have  include: <script type="text/javascript" src="http://localhost/intraweb/templates/inima/js/paramquery/jsZip-2.5.0/jsZip.min.js" ></script>   

In html i have this script:
   function fImport() {
      pq.grid( "#grid_json_design").showLoading()
       pq.excel.importXl( {url: '../../pro2/Content/workbook.xlsx'}, function( wb ){
         pq.grid.importWb({ workbook: wb, extraRows: 10, extraCols: 10 });
         pq.grid( "#grid_json_design").hideLoading();
      });
   }


where is the problem?

Thanks!

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6210
    • View Profile
Re: JSZip is not a constructor
« Reply #1 on: September 14, 2021, 11:04:49 am »
jszip url may be incorrect or you may have added other version of jszip before including v2.5.0 of jszip in your code.

Please share a jsfiddle or a stackblitz if you still need help in locating the cause of error.

ronrosell

  • Pro Enterprise
  • Newbie
  • *
  • Posts: 10
    • View Profile
Re: JSZip is not a constructor
« Reply #2 on: February 09, 2022, 05:46:25 am »
I ran into the same issue, and finally figured it out.

There's an error in the Tutorial; it instructs you to add jszip.js toward the end of the header. It needs to be added before pqgrid.min.js so that the latter can recognize that jszip is installed when it loads.

Simply reordering those two lines in the header, putting jszip.js (or the minimized version) first, resolved the problem for me.

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6210
    • View Profile
Re: JSZip is not a constructor
« Reply #3 on: March 14, 2022, 08:16:23 am »
Hi ronrosell

Thanks for mentioning the error in tutorial, it's been corrected.