-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
[DataGrid] Allow to set in GridExportCsvOptions delimiter #1859
[DataGrid] Allow to set in GridExportCsvOptions delimiter #1859
Conversation
FYI the comma as decimal separator is according to the culture. So in the uk they use 1, 000 and in Fr, they use 1 000 I think. |
You're talking about the thousand separator. Using Number.prototype.toString() we don't get the thousands separator which I think we shouldn't use in CSV. For example, in many European countries, the number 3.14 in the csv file is automatically treated by Excel as a string. If the decimal separator is ',' (3,14), Excel detects as a number. |
@michallukowski I proposed in #1814 (comment) that we apply the value formatter to the CSV export too. With it, you would be able to change how numbers are formatted when exported. This is what Damien refers to. Regarding this PR, I would avoid adding specific options to control number formatting. We could leverage
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we add a test case for the new delimiter
param?
Using Number.prototype.toString() we don't get the thousands separator which I think we shouldn't use in CSV.
Agree, I don't see why we would want to format a number in CSV exports. It seems better to be able to rely on the CSV reader to automatically detect a number and handle it accordingly (e.g. for formatting based on the locale of the CSV reader or further math operations).
packages/grid/_modules_/grid/hooks/features/export/seralizers/csvSeraliser.ts
Show resolved
Hide resolved
Yes so basically don't do anything special for numbers, we should consider using formatters on export |
…csvSeraliser.ts Co-authored-by: Olivier Tassinari <olivier.tassinari@gmail.com>
….com/michallukowski/material-ui-x into my-grid-toolbar-export-csv-separator
This reminds me that I don't think that the CSV export currently uses the |
Add option in GridExportCsvOptions to set delimiter character
Fix 1. of #1440