I am new to react-admin and I would like to have the possibility to export my CSV file to Excel.
import {FieldGuesser, ListGuesser, InputGuesser} from "@api-platform/admin";
import React from "react";
import jsonExport from 'jsonexport/dist';
import { ReferenceInput, SelectInput, Filter, downloadCSV } from 'react-admin';
const orderExporter = orders => {
const ordersForExport = orders.map(order => {
return {
"Name": order.name,
"Email": order.clientEmail,
"Code": order.programCode,
};
});
jsonExport(ordersForExport, {}, (err, csv) => {
downloadCSV(csv, 'orders');
});
};
export const OrderList = props => (
<ListGuesser {...props} exporter={orderExporter} filters={<OrderFilter/>}>
<FieldGuesser label="Statut" source={"status"}/>
<FieldGuesser label="Name" source={"name"}/>
</ListGuesser>
);
Do I have to create a new component with a special library? Thanks