Added Prop to csv/exporter.js to allow overriding of the Blob's default type (#958)

This commit is contained in:
William Laugesen 2019-06-07 17:18:50 +12:00 committed by Allen
parent 4ec02b294a
commit 1cd31dc54c
4 changed files with 8 additions and 2 deletions

View File

@ -185,6 +185,9 @@ Default is `false`. Give true to avoid to attach the csv header.
#### noAutoBOM - [bool]
Default is `true`.
#### blobType - [string]
Default is `text/plain;charset=utf-8`. Change to update the blob type of the exported file.
#### exportAll - [bool]
Default is `true`. `false` will only export current data which display on table.

View File

@ -29,6 +29,7 @@ class ToolkitProvider extends statelessDecorator(React.Component) {
separator: PropTypes.string,
ignoreHeader: PropTypes.bool,
noAutoBOM: PropTypes.bool,
blobType: PropTypes.string,
exportAll: PropTypes.bool,
onlyExportFiltered: PropTypes.bool,
onlyExportSelection: PropTypes.bool

View File

@ -54,11 +54,12 @@ export const save = (
content,
{
noAutoBOM,
fileName
fileName,
blobType
}
) => {
FileSaver.saveAs(
new Blob([content], { type: 'text/plain;charset=utf-8' }),
new Blob([content], { type: blobType }),
fileName,
noAutoBOM
);

View File

@ -5,6 +5,7 @@ const csvDefaultOptions = {
separator: ',',
ignoreHeader: false,
noAutoBOM: true,
blobType: 'text/plain;charset=utf-8',
exportAll: true,
onlyExportSelection: false
};