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

[data-grid] Fix print export feature #31807

Merged
merged 1 commit into from
Mar 15, 2022

Conversation

oliviertassinari
Copy link
Member

@oliviertassinari oliviertassinari commented Mar 15, 2022

The reproduction:

  1. open https://mui.com/components/data-grid/export/
  2. click on the print button.

Screenshot 2022-03-15 at 01 24 52

It was first raised by @alexfauquette in https://mui-org.slack.com/archives/G011VC970AW/p1646824105396129. I broke it in #31062.

@DanailH Should we document this limitation? Maybe this is a strong case for having a new intermediary API like AG Grid, one that only puts the grid in a print-ready mode to avoid the iframe.


@danilo-leal A side note on the screenshot. Did we recently work on the CSS of the "bg": "inline"}} option? It feels a bit broken. On https://mui.com/components/data-grid/export/#disabled-format

Current

Screenshot 2022-03-15 at 01 30 13

Expected?

Screenshot 2022-03-15 at 01 30 33

@oliviertassinari oliviertassinari added bug 🐛 Something doesn't work component: data grid This is the name of the generic UI component, not the React module! regression A bug, but worse labels Mar 15, 2022
@mui-bot
Copy link

mui-bot commented Mar 15, 2022

No bundle size changes

Generated by 🚫 dangerJS against 948c3e8

@DanailH
Copy link
Member

DanailH commented Mar 15, 2022

@DanailH Should we document this limitation? Maybe this is a strong case for having a new intermediary API like AG Grid, one that only puts the grid in a print-ready mode to avoid the iframe.

I think so, yes. We can and a warning or a note under the Print export docs to let users be aware of this case.

Regarding the intermediate API - I'm not sure how we can render the grid in a print-ready mode on the page without messing up the general page layout (the case where you have pagination but all the grid rows are rendered for the print). I can check how AG Grid handles that case. Either way, if there is an API that puts the grid into a print-ready state then there should be one that reverts it back to its previous state.
Maybe we can wait and see if there would be a demand for an API like this 🤔

@oliviertassinari
Copy link
Member Author

I have tested the fix in mui/mui-x#4195, it works.

@oliviertassinari oliviertassinari merged commit 881a9b7 into mui:master Mar 15, 2022
@oliviertassinari oliviertassinari deleted the fix-print-export branch March 15, 2022 10:01
@oliviertassinari
Copy link
Member Author

We can and a warning or a note under the Print export docs to let users be aware of this case.

@DanailH Agree, is there an issue/PR open about it?

@DanailH
Copy link
Member

DanailH commented Mar 18, 2022

@oliviertassinari sorry for the delay, it was on my week's TODO list. Here is the PR mui/mui-x#4222

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 Something doesn't work component: data grid This is the name of the generic UI component, not the React module! regression A bug, but worse
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants