[Data Grid] [Data Grid] Export CSV fails in Chrome for big datasets

Forge Component
(36)
Published on 17 Mar (11 days ago) by OutSystems R&D
36 votes
Published on 17 Mar (11 days ago) by OutSystems R&D

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