Skip to content

Commit

Permalink
fix(datagrid-web): revert back to .map() usage
Browse files Browse the repository at this point in the history
  • Loading branch information
rahmanunver authored and gjulivan committed Jan 19, 2024
1 parent 17400ab commit df1e693
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 deletions packages/pluggableWidgets/datagrid-web/src/features/export.ts
Original file line number Diff line number Diff line change
Expand Up @@ -229,12 +229,9 @@ type ExportDataResult =
};

function exportData(data: ObjectItem[], columns: ColumnsType[]): ExportDataResult {
const rows = [];
let hasLoadingItem = false;

for (const item of data) {
const row = [];
for (const column of columns) {
const items = data.map(item => {
return columns.map(column => {
let value = "";
if (column.showContentAs === "attribute") {
value = column.attribute?.get(item)?.displayValue ?? "";
Expand All @@ -250,18 +247,17 @@ function exportData(data: ObjectItem[], columns: ColumnsType[]): ExportDataResul
} else {
value = "n/a (custom content)";
}
row.push(value);
}
rows.push(row);
}
return value;
});
});

if (hasLoadingItem) {
return {
status: "pending"
};
}

return { status: "ready", message: { type: "data", payload: rows } };
return { status: "ready", message: { type: "data", payload: items } };
}

type CallbackFunction = (msg: Message) => Promise<void> | void;
Expand Down

0 comments on commit df1e693

Please sign in to comment.