Skip to content
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

[DataGridPro] What is the configuration to export all table rows? #3610

Closed
2 tasks done
lincolnmqs opened this issue Jan 12, 2022 · 4 comments · Fixed by #3687
Closed
2 tasks done

[DataGridPro] What is the configuration to export all table rows? #3610

lincolnmqs opened this issue Jan 12, 2022 · 4 comments · Fixed by #3687
Assignees
Labels
component: data grid This is the name of the generic UI component, not the React module! feature: Export new feature New feature or request plan: Pro Impact at least one Pro user

Comments

@lincolnmqs
Copy link

lincolnmqs commented Jan 12, 2022

Order ID 💳

35305

Duplicates

  • I have searched the existing issues

Latest version

  • I have tested the latest version

Summary 💡

There is csvOptions configuration to export all columns "allColumns". Is there for the lines too? I'm using the "Group and Pivot" functionality, and my extended lines only export if they are opened.

The problem in depth 🔍

In the image I highlighted the lines that are being exported, but the last one is the same as the second and is not being exported because it is not open.

image

There is this configuration for the documentation (https://mui.com/api/data-grid/grid-csv-export-options/)

Context 🔦

Your environment 🌎

`npx @mui/envinfo`
  Don't forget to mention which browser you used.
  Output from `npx @mui/envinfo` goes here.
@lincolnmqs lincolnmqs added plan: Pro Impact at least one Pro user support: question Community support but can be turned into an improvement status: waiting for maintainer These issues haven't been looked at yet by a maintainer labels Jan 12, 2022
@flaviendelangle
Copy link
Member

flaviendelangle commented Jan 14, 2022

The current export logic is as follow

  • If there is at least one selected rows, export the selected rows.
  • Otherwise, export all the rows that pass the filtering process (ie: the rows matching the filterModel and not collapsed)

We have another issue of someone asking to export all the rows even when some are selected.
I feel like we could add a new option to GridCsvExportOptions.
Something like getRowsToExport?: (allRows: GridRowModel[]) => GridRowModel[] which would let users pick whatever rows they want for there custom usecase.

@joserodolfofreitas @DanailH what is your feeling on this ?

@flaviendelangle flaviendelangle added component: data grid This is the name of the generic UI component, not the React module! new feature New feature or request and removed status: waiting for maintainer These issues haven't been looked at yet by a maintainer support: question Community support but can be turned into an improvement labels Jan 14, 2022
@joserodolfofreitas
Copy link
Member

I agree that a getRowsToExport could be useful when we think about customization. But regarding the default behavior, I'd also expect to get the data from the collapsed rows as well (if they are matching the current filtering criteria), and I'd expect that because a collapsed row has more to do with UX and better visualization, than with data operations per se (like the filtering).

@flaviendelangle
Copy link
Member

So for you the default behavior should be : all the rows passing the filter models, including the collapsed children ?

Side note, for #3277 having a custom callback will be even more useful to allow to export only the leaves for instance.

@flaviendelangle
Copy link
Member

flaviendelangle commented Jan 18, 2022

I will probably take this enhancement once the #3550 and #3554 are finished 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: data grid This is the name of the generic UI component, not the React module! feature: Export new feature New feature or request plan: Pro Impact at least one Pro user
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants