Nacim Goura
Nacim Goura

Reputation: 1

How to export all fields with exporter ? (react-admin)

I created my react-admin exporter to export my data. But the problem is that I only get the fields I display in my list when I want to export all the fields (even those visible in edit or display). Even with fetchRelatedRecords I don't recover all the data. How to export all existing fields ? For example, I display id and name in the table. In add and edit I have other fields available in addition to these. I want to export all the fields in my database and not just those displayed in the table.

Upvotes: 0

Views: 1889

Answers (1)

Gildas Garcia
Gildas Garcia

Reputation: 7066

The export function does not care about the fields you chose to display. As explained in the documentation, the export button will call the dataProvider with the current sort and filter (but without pagination) and transform all the fields of the records in the dataProvider response into a CSV string.

So if some fields aren't there, it means your API did not return them. Be advised that the dataprovider call the same endpoint as for the list so make sure that when the API doesn't receive pagination params in this request, it returns the data expected for exports

Upvotes: 1

Related Questions