-
-
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] Add support for getRowsToExport
option to print export
#10084
[DataGrid] Add support for getRowsToExport
option to print export
#10084
Conversation
Netlify deploy previewNetlify deploy preview: https://deploy-preview-10084--material-ui-x.netlify.app/ Updated pagesThese are the results for the performance tests:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for submitting the solution, the solution looks clean and solid to me 🎉
One question that comes in my mind is, should we persist the checkboxes in the print version (like we did before this change), at least when there is no selection (possibly by skipping calling the updateGridRowsForPrint
when there's no selection.) Will that be a user's expectation in some use-cases?
P.S You might need to run yarn docs:api
to regenerate the docs and fix the build.
Sorry for such a late reply @MBilalShafi - I've been swamped at work and traveling so just haven't had much free time until now. That's a good point to discuss. However, it seems that the current behavior regarding preserving checkboxes already does not include the checkboxes on print export. As of the time of my writing it seems that regardless of whether or not rows are selected the checkboxes are NOT preserved in the print export. I think that this behavior actually more closely matches user expectations for the following reasons. First, the checkboxes are already not preserved when exporting as CSV and so omitting them from the print export would maintain consistency between the two methods. Second, generally users export data for reporting, presentation, or analysis. Visual elements like checkboxes don't carry data significance and thus are not necessary in the exported content. IMO the checkboxes clutter the data representation unnecessarily as the user is anticipating getting the data, not the UI elements. Third, in a digital interface a checkbox provides an interactive element for selection. In a printed or exported static format its functional relevance is lost. These all lead me to believe that omitting the checkboxes for print export would deliver the best user experience. As I mentioned it seems that is now the current behavior, anyways. Here's a sandbox using the latest package version (without my code changes). Notice that when exporting via print the checkboxes are never included. I do think that only calling Although not the typical use case I do believe providing an option to preserve the checkboxes, such as I also fixed an issue in my initial implementation where the Grid footer was not being correctly placed when exporting selected rows via print. Instead of appearing directly underneath the selected rows it appeared at the bottom of the page where it would have been had no rows been selected. This is now fixed and appearing as expected in the correct place. I have ran the appropriate commands to ensure code formatting and new docs generation as well as syncing up with the master branch so hopefully this PR is ready for review. If there's any other issues or points of discussion I'd be happy to address them. |
packages/grid/x-data-grid/src/hooks/features/export/useGridPrintExport.tsx
Outdated
Show resolved
Hide resolved
packages/grid/x-data-grid/src/hooks/features/export/useGridPrintExport.tsx
Outdated
Show resolved
Hide resolved
…-selected-rows-bugfix
This reverts commit 85825b0.
getRowsToExport
option to print export
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you!
I've opened #10410 to change the default behavior in v7, as we discussed 👍🏻 |
amazing. Happy to help! |
Fixes #9993
Fixes #9824
I created this PR in response to an issue I submitted regarding the Grid Print Export feature.
There was an inconsistency between the behavior and implementation of the CSV export and Print Export. When rows are selected and CSV export is chosen then only the selected rows are exported. However, when attempting to export selected rows using the Print option then all of the rows were being exported and the selection was not being honored.
This PR fixes this issue and attempts to make the implementations more similar and consistent.