AlaSQL / alasql

AlaSQL.js - JavaScript SQL database for browser and Node.js. Handles both traditional relational tables and nested JSON data (NoSQL). Export, store, and import data from localStorage, IndexedDB, or Excel.
http://alasql.org
MIT License
7.04k stars 659 forks source link

Table export to excel using alasql in Chrome 32bit version getting TypeError: get_URL(…).createObjectURL is not a function #761

Open indianchiran opened 8 years ago

indianchiran commented 8 years ago

Am trying to export table data into excel sheet using alasql.js.It's working fine in Mozilla firefox and Googlechrome 64bit version but am getting error in Google Chrome 32bit version. I tried FileSaver.js also same error am facing. Please help me on this. Thanks in advance.

Here is a my code.

Data : [{"id":"1","firstname":"test","lastname":"test2","email":"test@gmail.com","phone_number":"7204690129"}]

In Controller.js

var exportDataexel = $scope.data;
$scope.exportDataExcel = function () {
         alasql("SELECT firstname AS Firstname,lastname AS Lastname,email AS Email, phone_number AS Phonenumber INTO XLSX('Report.xlsx',{headers:true}) FROM ?",[exportDataexel]);
};

In Chrome console displaying error like this and excel file not downloading.

angular.min.js:107 TypeError: get_URL(...).createObjectURL is not a function
at new FileSaver (alasql.js:17501)
at saveAs (alasql.js:17577)
at saveWorkbook (alasql.js:15284)
at doExport (alasql.js:15169)
at Object.alasql.into.XLSX (alasql.js:15142)
at eval [as intoallfn] (eval at <anonymous> (alasql.js:7259), <anonymous>:3:33)
at queryfn3 (alasql.js:6548)
at queryfn2 (alasql.js:6295)
at Object.eval [as datafn] (eval at <anonymous> (alasql.js:7633), <anonymous>:3:57)
at alasql.js:6246
indianchiran commented 8 years ago

Hi mathiasrw, Thanks for your response. I attached console error please find the attachment. alasqlerror

Please check in Windows7 32bit operating system Google Chrome browser and take data minimum 50 to 100 records.

mathiasrw commented 8 years ago

What do you get from alasql.version ?

indianchiran commented 8 years ago

@module alasql @version 0.3.2-alasql-601-csv-variable-1413. Am using above version its working in IE9,Firefox,and 64bit chrome also but not in 32bit Chrome(Version 53.0.2785.143 m).

mathiasrw commented 8 years ago

awwww - how do I get a 32bit version of chrome? can I install it along side my normal one?

indianchiran commented 8 years ago

Yes you can install and check. If your operating system is 32bit windows7 chrome installer automatically installs. I verified with other systems also am getting same error like " TypeError: get_URL(…).createObjectURL is not a function"

Debug also done my side but no luck. Thank you.

indianchiran commented 8 years ago

Hi Mathiasrw,

Are you able to reproduce the problem? Because am waiting for your response.

mathiasrw commented 8 years ago

@indianchiran I have had very little time for side projects lately- so I have not gone further into replicating this problem.

I should have let you know.

Have you had a look at https://github.com/eligrey/FileSaver.js/issues/143#issuecomment-103006630 ? Are you using any variables named URL in your project that could interfear? I cant find any in AlaSQL

But it is really strange that its only with 32bit version...

Could you try to use https://github.com/agershun/alasql/blob/develop/dist/alasql.fs.js and let me know what line is affected? Maybe make a breakpoint and see what the get_URL() returns that does not have the createObjectURL property as a function?