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

[DataGrid] Add new CSV export option: getRowsToExport #3687

Merged
merged 18 commits into from Jan 26, 2022

Conversation

flaviendelangle
Copy link
Member

@flaviendelangle flaviendelangle commented Jan 21, 2022

  • Docs
  • Tests

Closes #3610

  • Export the collapsed groups by default on the CSV export (if you feel it's better to do a one-liner standalone PR for this change I can)
  • Add a new getRowsToExport method to GridCsvExportOptions
  • Add a test
  • Add doc examples with and without row grouping

@flaviendelangle flaviendelangle added the component: data grid This is the name of the generic UI component, not the React module! label Jan 21, 2022
@flaviendelangle flaviendelangle self-assigned this Jan 21, 2022
@flaviendelangle flaviendelangle changed the title [DataGrid] Add new CSV export option: getRowsToExport [DataGrid] Add new CSV export option: getRowsToExport Jan 21, 2022
@mui-bot
Copy link

mui-bot commented Jan 21, 2022

These are the results for the performance tests:

Test case Unit Min Max Median Mean σ
Filter 100k rows ms 166.9 383.2 255.4 264.22 84.035
Sort 100k rows ms 301.2 674.5 661.7 588.14 143.898
Select 100k rows ms 158.1 309.3 188.5 209.66 53.139
Deselect 100k rows ms 118.5 290 183.8 179.56 62.661

Generated by 🚫 dangerJS against 78392b3

@flaviendelangle flaviendelangle marked this pull request as ready for review January 25, 2022 14:48
@flaviendelangle
Copy link
Member Author

@cherniavskii #3736 being merged, I updated the behavior to export the collapsed rows.
The doc examples and the default behaviors should not be consistent.

I'm adding @joserodolfofreitas for the doc part

@@ -14,6 +17,13 @@ export interface GridExportOptions {
allColumns?: boolean;
}

export interface GridCsvGetRowsToExportParams {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm only passing the apiRef since most of the time users will want to use a selector, and selectors should be given the apiRef instead of the state whenever possible after #3663.

Not sure if we want to pass anything else.
We could pass a callback to generate them (like getDefaultRowsToExport), but the behavior is so simple right now that I'm not sure it would be very useful.

Anyway, I let the params as an object to be able to add things later.

Copy link
Member

@joserodolfofreitas joserodolfofreitas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like how powerful the getRowsToExport method is. But I'm not sure we should use it to address the export without groups from row grouping.

I'd leave the current example for now, but replace it soon with an easier way to handle this case. Something like "disableRowGrouping". What do you think?
I'll then open a new issue for it.

docs/src/pages/components/data-grid/export/export.md Outdated Show resolved Hide resolved
docs/src/pages/components/data-grid/export/export.md Outdated Show resolved Hide resolved
docs/src/pages/components/data-grid/export/export.md Outdated Show resolved Hide resolved
flaviendelangle and others added 6 commits January 26, 2022 09:26
Co-authored-by: José Rodolfo Freitas <joserodolfo.freitas@gmail.com>
Co-authored-by: José Rodolfo Freitas <joserodolfo.freitas@gmail.com>
Co-authored-by: José Rodolfo Freitas <joserodolfo.freitas@gmail.com>
Copy link
Member

@joserodolfofreitas joserodolfofreitas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's looking great!
Just one more point about the default exported rows.

docs/src/pages/components/data-grid/export/export.md Outdated Show resolved Hide resolved
Co-authored-by: José Rodolfo Freitas <joserodolfo.freitas@gmail.com>
@github-actions github-actions bot added the PR: out-of-date The pull request has merge conflicts and can't be merged label Jan 26, 2022
@github-actions
Copy link

This pull request has conflicts, please resolve those before we can evaluate the pull request.

@github-actions github-actions bot removed the PR: out-of-date The pull request has merge conflicts and can't be merged label Jan 26, 2022
@flaviendelangle flaviendelangle merged commit cec6c17 into mui:master Jan 26, 2022
@flaviendelangle flaviendelangle deleted the getRowsToExport-csv branch January 26, 2022 14:23
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!
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[DataGridPro] What is the configuration to export all table rows?
4 participants