78
Views
5
Comments
[Data Grid] [Data Grid] Export CSV fails in Chrome for big datasets
Question
Forge component by OutSystems R&D
41
Published on 13 Oct 2020

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

Staff
Rank: #6489

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

Rank: #25375

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.