Skip to content

Commit

Permalink
fix #1410
Browse files Browse the repository at this point in the history
  • Loading branch information
AllenFang committed Jun 26, 2017
1 parent 624764c commit 340dc8d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
10 changes: 6 additions & 4 deletions src/BootstrapTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -1045,7 +1045,7 @@ class BootstrapTable extends Component {
let result = {};

let { csvFileName } = this.props;
const { onExportToCSV, exportCSVSeparator } = this.props.options;
const { onExportToCSV, exportCSVSeparator, noAutoBOM } = this.props.options;
if (onExportToCSV) {
result = onExportToCSV();
} else {
Expand Down Expand Up @@ -1073,7 +1073,7 @@ class BootstrapTable extends Component {
csvFileName = csvFileName();
}

exportCSVUtil(result, keys, csvFileName, separator);
exportCSVUtil(result, keys, csvFileName, separator, noAutoBOM || true);
}

handleSearch = searchText => {
Expand Down Expand Up @@ -1563,7 +1563,8 @@ BootstrapTable.propTypes = {
expandBodyClass: PropTypes.oneOfType([ PropTypes.string, PropTypes.func ]),
expandParentClass: PropTypes.oneOfType([ PropTypes.string, PropTypes.func ]),
beforeShowError: PropTypes.func,
printToolBar: PropTypes.bool
printToolBar: PropTypes.bool,
noAutoBOM: PropTypes.bool
}),
fetchInfo: PropTypes.shape({
dataTotalSize: PropTypes.number
Expand Down Expand Up @@ -1715,7 +1716,8 @@ BootstrapTable.defaultProps = {
expandBodyClass: null,
expandParentClass: null,
beforeShowError: undefined,
printToolBar: true
printToolBar: true,
noAutoBOM: true
},
fetchInfo: {
dataTotalSize: 0
Expand Down
4 changes: 2 additions & 2 deletions src/csv_export_util.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,12 @@ function toString(data, keys, separator) {
return dataString;
}

const exportCSV = function(data, keys, filename, separator) {
const exportCSV = function(data, keys, filename, separator, noAutoBOM) {
const dataString = toString(data, keys, separator);
if (typeof window !== 'undefined') {
saveAs(new Blob([ dataString ],
{ type: 'text/plain;charset=utf-8' }),
filename, true);
filename, noAutoBOM);
}
};

Expand Down

0 comments on commit 340dc8d

Please sign in to comment.