feat: convert non-object rows to array of objects in DataOutputComponent

This commit is contained in:
anovazzi1 2024-06-27 13:59:13 -03:00 committed by Gabriel Luiz Freitas Almeida
commit 71f3bfcf51

View file

@ -10,9 +10,14 @@ function DataOutputComponent({
columnMode = "union",
}: {
pagination: boolean;
rows: any;
rows: any[];
columnMode?: "intersection" | "union";
}) {
// If the rows are not an array of objects, convert them to an array of objects
if(rows.some((row) => typeof row !== "object")) {
rows = rows.map((row) => ({ data: row }));
}
const columns = extractColumnsFromRows(rows, columnMode);
const columnDefs = columns.map((col, idx) => ({