[data grid] Commas in exported files are not handled correctly if value is in array
Steps to reproduce
(Note: we are still on 6.x but as per the sandbox here it appears to happen in 7.x as well)
Link to live example: https://codesandbox.io/p/sandbox/cocky-haslett-kmw4hv?file=%2Fsrc%2FDemo.tsx%3A8%2C18
Steps:
- Have data that is in an array and has commas -- e.g. the value is ["Test1, Test2"]
- Use CSV export
- Notice that the outputted value takes up more columns than expected, messing up that row's column alignment
This is a case not handled by #1143
Current behavior
The outputted value takes up more columns than expected, messing up that row's column alignment
What you can do right now as a workaround is use the valueFormatter -- although this somewhat bothers me as it seems to potentially affect more than just the csv export functionaltiy
e.g. you can do this:
valueFormatter: ({ value, ...rest }) => {
if (Array.isArray(value)) {
return value.reduce((prev, curr) => {
return prev + curr
}, '')
}
return value
},
Expected behavior
Would be great if this worked as expected without the workaround of using valueFormatter
Context
We have values for our grid that are in arrays. These values can have strings with commas in them. We need to be able to export this data in a way that doesn't break columns.
Your environment
I don't know that this matters -- you can see that it occurs in the sandbox shared above.
Search keywords: commas, csv, export, arrays Order ID: 77204
There is an option to use a different delimiter with the CSV export. Here is an updated example to showcase that: Delimiter change on CSV export
Does that help you?
The issue has been inactive for 7 days and has been automatically closed.
This "auto-close when inactive for 7 days" behavior seems a little odd... anyway, this is still an issue, but I've made a PR that fixes it.
See #13560
The behavior of the auto-close is correct, it does that when there is no comment being added although we are waiting for the author of the ticket to answer.
It's that way because I did provide a solution, but no answer came back.
Thanks for opening a PR for this. I will assign a reviewer for that
@michelengelen Your proposed solution isn't what I'm looking for, no. I haven't given it a deep review but I believe @joeycumines-scw's PR is what I had in mind as a solution
In that case please say so ... how should we know otherwise? 🤷🏼
:warning: This issue has been closed. If you have a similar problem but not exactly the same, please open a new issue. Now, if you have additional information related to this issue or things that could help future readers, feel free to leave a comment.
@z0d14c: How did we do? Your experience with our support team matters to us. If you have a moment, please share your thoughts in this short Support Satisfaction survey.