Hi,
I'm trying to export a big data set (2K+) rows using the export CSV feature. This works in Firefox but when trying in Chrome it will fail with "Failed - Network Error". For small files it works fine.
I've tried to debug this and it seems it is failing at the exportFile function of the GridFramework.js script.
Replacing the code in the dev tools with this code, works immediately:
exportFile: function(csv, fileName) { var fileType = 'txt/csv;charset=utf-8'; var blob = new Blob([csv], { type: fileType }); if (navigator.msSaveBlob) { // IE navigator.msSaveBlob(blob, fileName); } else { var e = document.createElement('a'); e.setAttribute('href', window.URL.createObjectURL(blob)); e.setAttribute('download', fileName); e.setAttribute('target', '_blank'); e.style.display = 'none'; document.body.appendChild(e); e.click(); document.body.removeChild(e); } }
This version is better as it correctly supports big files. Can it be included in the component?
Regards,
Gabriel Santos
Hi Gabriel
Could you please try to reproduce it. This is a quite old message and the component is suffering improvements all releases/months, so maybe it was already fixed.
During my tests I could export to CSV a grid with 13K rows.
Thank you
Ricardo Valim
I am using the latest Data Grid component, and have a grid of 73,005 rows of 33 columns to export to Excel. Using Chrome, it becomes unresponsive and you get the Wait dialog, which never comes back and runs Chrome out of memory once you stop trying to wait. Copying the data from the rendered grid control and pasting into Excel results in a file of approximately 3.5 MB.
Coy Kissee wrote:
Hi Coy. Are you exporting w/o styles ? It can make a big difference for excel exports.
Mark Jurkovich wrote:
I am using the built-in Export Excel Button.
Try right clicking on the grid >>> export >>> Excel export (w/o styles). I think the button exports with styles. If I remember correctly , I may have had to customize the button. Anyway see if the right click menu helps.