Skip to content

Commit

Permalink
#7324 speed up the csv download method
Browse files Browse the repository at this point in the history
  • Loading branch information
Mariusz Jurowicz committed May 11, 2018
1 parent a6a1715 commit 4f22fbf
Showing 1 changed file with 12 additions and 17 deletions.
29 changes: 12 additions & 17 deletions js/notebook/src/tableDisplay/dataGrid/cell/CellManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -263,34 +263,29 @@ export default class CellManager {
};

function exportCells(cells, exportOptions) {
let out = '';
let out = [];

for (let i = 0; i < cells.length; i++) {
let row = cells[i];

for (let j = 0; j < row.length; j++) {
if (j !== 0) {
out = out + exportOptions.sep;
}

let cellData = row[j];
if (cellData === null) {
cellData = '';
}

cellData = cellData + '';
out = [
out,
exportOptions.qot,
(cellData !== undefined && cellData !== null ? fix(cellData) : ''),

out.push(`${
j !== 0 ? exportOptions.sep : ''
}${
exportOptions.qot
}${
(cellData !== undefined && cellData !== null ? fix(cellData + '') : '')
}${
exportOptions.qot
].join('');
}`);
}

out = out + exportOptions.eol;
out.push(exportOptions.eol);
}

return out;
return out.join('');
}

if (format === 'tabs') {
Expand Down

0 comments on commit 4f22fbf

Please sign in to comment.