Hello,
I have a grid with the excelExporter
feature configured and it is working well. However, I have some data that I need to format before it is useful within a spreadsheet (example: transforming a UNIX timestamp into a Date object).
I found in the documentation that the excelExporter uses the TableExporter
class and the TableExporter
has an isExport
property (https://www.bryntum.com/docs/grid/#Grid/util/TableExporter#column-renderers) I can destruct from the renderer parameter on the column definition. However, when I add a check for the isExport
property, it is undefined in the normal column rendering (makes sense), but the generated Excel document is unchanged. I also found that the renderer function isn't logging anything to the console after exporting, so it looks like the function isn't being called during the export. In the example below, I would expect the Customer Status to read Something else
in each column, but it displays the normal values.
{
id: "customer.status",
field: "customer.status",
text: "Customer Status",
width: 180,
hidden: true,
filterable: false,
sortable: false,
renderer: ({ record, cellElement, isExport }) => {
if (isExport) {
return "Something else";
}
cellElement.innerHTML = record?.data?.customer
? record.data.customer.status
: "";
}
},
Any help would be much appreciated!