-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[DataGrid] Implement CSV export #197
Comments
What would be the recommended path for current material-ui consumer apps to design a CSV export feature? I'd like to be able to switch to material-ui table / datagrid once that's ready without doing the whole thing again if possible. |
@keremgocen I think that you would depend on #190. We need to expose an API to integrate with the state of the data grid. |
Hi, is there a date for this to be released? We are urgently needing to export our XGrid table into a CSV file. Thank you. |
@AleKrabbe we aim to implement this feature Q1 2021. We mention it in the public roadmap: https://github.com/mui-org/material-ui-x/projects/1. |
Ok so I was thinking about how to handle the UX part and this is what I managed to come up with: The main challenge is to make the UX in such a way that can handle also Excel export in the future if we choose to do it. I would propose to go in the direction of having a button per export option in the toolbar - my argument is that this way developers can opt-in on any option and this will also make the UI simpler since I can predict that we would need at least 2 options per export type (to export all or to export only selected rows). Also, I propose we do a hook per export type because that way it will be easier to split them between the open-source and enterprise versions of the data grid. On the props side, we would need a handler like In terms of the API - most likely we would need 2 methods, one to get the data in a CSV format and one to download it. |
|
First I thought of doing it like this, my argument against it is that if we want to have functionality like export all or to export only selected rows for example that would mean that we need a second level in the menu. I'm not saying it is bad but the downside is that it won't be the best experience on mobile, but if that is not a concern I prefer it that way. Another concern is that if someone wants to have PDF export but not CSV for example if they are in the same menu we would need to introduce a prop to disable each one of them. If we make them as separate buttons since they are all opt-in separately we will avoid that case.
Yes exactly - also this will allow for devs to be able to react to that action - maybe redirect or display something, etc. I can also delay adding it and see if there will be a demand for it. |
OK, for the toolbar, we can go with a simple approach. If it doesn't work, we will hear about it. Should it be an icon button to safe horizontal space? |
I made a draft, let's move the discussion regarding the UI there, it will be easier to follow it and address it. |
4 UIs inspiration I could find added to the original comment #197 (comment). |
We have started to work on the feature a year ago, the person that takes on this task can refer to mui/material-ui#18872 and this code: saveAs.
Research
UIs inspiration I could find:
The "More options" button opens a modal where you can select the format of the CSV file.
Benchmark
The text was updated successfully, but these errors were encountered: