-
Notifications
You must be signed in to change notification settings - Fork 933
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
Download CSV is broken with customBodyRender #973
Comments
Thanks for opening. I've been looking into the react object identification as part of this, but it turns out this issue is not exactly that. It was a failure of the logic to account for the displayed data index. There was no problem until the data was sorted for a custom render, but once sorted, the index isn't maintained. I've added a fix for that to the PR I opened for the other issue as they involve the same line of code. |
Hi. Thank you so much for being so responsive. Unfortunately, this needs to be re-opened as it is not solved in 2.12.0. On mui-datatables/src/components/TableToolbar.js Line 113 in b8bee52
when column is indeed a React component, it looks like this:
[{…}]
0: {$$typeof: Symbol(react.element), key: "17", ref: null, props: {…}, type: ƒ, …}
length: 1
__proto__: Array(0) and such it is an array and it fails the check, and doesn't pass the original value from data ( The output of |
The way you are using it now is actually unsupported behavior. You have to return either a react component or a string from |
Thanks. I guess I need to find a workaround for this as this is a show stopper. |
What is it you are trying to do exactly? Seems to me that you should be able to do just about anything with a component. If you need a list of something in the cell, then wrap a component around your map. Just make sure there's a component around everything in the |
Yep, that's the workaround. It works now. |
Ok, glad it works! The render functions are only set up to pass components and strings, It's just how they work, but I think they should provide enough for most use cases with those options. |
My solution was create 2 columns one with custom body render (options:{download:false}), and second column is a normal but hidden with display "false"
with this we can get the data to csv download! |
A continuation of #963 and (possibly) reopening of #275 .
Expected Behavior
Having a customBodyRender should produce CSV file that looks exactly like shown in UI.
Current Behavior
Downloaded csv (in case of columns with customBodyRender) produces out-of-order output.
Like if UI shows:
the downloaded CSV shows:
Steps to Reproduce (for bugs)
https://codesandbox.io/s/suspicious-feynman-mf925
Your Environment
Since React 0.14, Dan Abramov says they are tagging react components to be easilty identified. Maybe this can help.
The text was updated successfully, but these errors were encountered: