Skip to content

[data grid] Fix CSV export for null and undefined values#14166

Merged
arminmeh merged 6 commits intomui:masterfrom
k-rajat19:14082
Aug 14, 2024
Merged

[data grid] Fix CSV export for null and undefined values#14166
arminmeh merged 6 commits intomui:masterfrom
k-rajat19:14082

Conversation

@k-rajat19
Copy link
Contributor

@k-rajat19 k-rajat19 commented Aug 11, 2024

Fixes #14082

this issue comes from the changes done in #13560 , the motive of that PR is to convert any non-string value into a string using template literals but it also converts null and undefined values into strings which then exported to CSV as a string.
I have added a check for these values.

@k-rajat19
Copy link
Contributor Author

k-rajat19 commented Aug 11, 2024

not sure if this check should stay here or not, it probably not
before #13560 this check was useful to opt out of null and undefined values

if (value === null || value === undefined) {
this.rowString += '';

@k-rajat19 k-rajat19 changed the title [data-grid] Fix CSV export for null and undefined values [data grid] Fix CSV export for null and undefined values Aug 11, 2024
@zannager zannager added the scope: data grid Changes related to the data grid. label Aug 12, 2024
@arminmeh arminmeh added type: regression A bug, but worse, it used to behave as expected. feature: Export labels Aug 12, 2024
@arminmeh
Copy link
Contributor

not sure if this check should stay here or not, it probably not before #13560 this check was useful to opt out of null and undefined values

if (value === null || value === undefined) {
this.rowString += '';

I have removed this, thanks for pointing it out

@arminmeh
Copy link
Contributor

I have added a test to the PR, to prevent future regressions.
Thanks for the contribution @k-rajat19

@mui-bot
Copy link

mui-bot commented Aug 12, 2024

Deploy preview: https://deploy-preview-14166--material-ui-x.netlify.app/

Generated by 🚫 dangerJS against d03e601

@arminmeh arminmeh merged commit 496d64e into mui:master Aug 14, 2024
@k-rajat19 k-rajat19 deleted the 14082 branch August 14, 2024 09:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature: Export scope: data grid Changes related to the data grid. type: regression A bug, but worse, it used to behave as expected.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[data grid] V7 CSV export regression for undefined and null values

4 participants