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

Print large amount of data #206

Closed
xStorm111 opened this issue Jan 8, 2020 · 7 comments
Closed

Print large amount of data #206

xStorm111 opened this issue Jan 8, 2020 · 7 comments

Comments

@xStorm111
Copy link

Hello, i'm trying to implement react-to-print on material-table and i'm having some issues for multiple page data.
Example:
I have this scenario where i have more rows than the window can show.
image

I implemented the code on material-table using gregnb/mui-datatable as an example.
But gregnb/mui-datatable print function reaches all data from tableContent and here i can only reach the tableContent that is displayed on the screen or less than that.
image

Expected Behavior

Print all data from table
image

@MatthewHerbst
Copy link
Owner

Hello. Could you please make a codesandbox or codepen that shows the problem? Thank you. My guess is it has to do with virtual rendering.

@xStorm111
Copy link
Author

Hello @MatthewHerbst, first of all thanks for the reply.
I created a mini project to show the problem and i imported it into a codesandbox as you asked
I will leave the link below:
https://codesandbox.io/s/tender-mirzakhani-mjng8

The code might be a bit confuse but the most important code about react-to-print is located on files utils/m-table-toolbar, utils/material-table and utils/index

@MatthewHerbst
Copy link
Owner

If I had to guess, passing the ref via props is not updating the ref correctly, but I'm not sure. I wonder if a simpler example could be made with just mui-datatable and react-to-print?

@xStorm111
Copy link
Author

Infortunately i don't think i can make an easier example. I created a new codesandbox with both datatables imported but i left the material-table commented.
I will leave the link below:
https://codesandbox.io/s/react-print-issue-with-material-table-idxwl

@MatthewHerbst
Copy link
Owner

@xStorm111 sorry for taking so long to get back to you. Does mui-datatable do virtual rendering? I think this is the same issue as #95

I'm taking another look at it. It should be fixable, but very difficult and will be hard to test it properly.

@xStorm111
Copy link
Author

@MatthewHerbst Hello, you don't have to be sorry for it.
I made some progress about this, i manage to realize this bug only happens IF i have maxBodyHeight defined.

Makes sense that react-to-print reacts that way to a maxBodyHeight

@MatthewHerbst
Copy link
Owner

@xStorm111 interesting. I wonder if a solution would be for react-to-print to remove that property if it exists? That seems like it could cause other problems though since we don't know anything else about the styles.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants