From 3f602755721529471ba5d5fa36ed2930d19dfbf5 Mon Sep 17 00:00:00 2001 From: AllenFang Date: Mon, 10 Jul 2017 21:37:15 +0800 Subject: [PATCH] fix #1410 for wrong boolean short circuit --- src/BootstrapTable.js | 2 +- src/csv_export_util.js | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/BootstrapTable.js b/src/BootstrapTable.js index 1ed3e6ee8..4f9f7fe18 100644 --- a/src/BootstrapTable.js +++ b/src/BootstrapTable.js @@ -1073,7 +1073,7 @@ class BootstrapTable extends Component { csvFileName = csvFileName(); } - exportCSVUtil(result, keys, csvFileName, separator, noAutoBOM || true, excludeCSVHeader); + exportCSVUtil(result, keys, csvFileName, separator, noAutoBOM, excludeCSVHeader); } handleSearch = searchText => { diff --git a/src/csv_export_util.js b/src/csv_export_util.js index 839f92479..929b47e83 100644 --- a/src/csv_export_util.js +++ b/src/csv_export_util.js @@ -61,6 +61,7 @@ function toString(data, keys, separator, excludeCSVHeader) { const exportCSV = function(data, keys, filename, separator, noAutoBOM, excludeCSVHeader) { const dataString = toString(data, keys, separator, excludeCSVHeader); if (typeof window !== 'undefined') { + noAutoBOM = noAutoBOM === undefined ? true : noAutoBOM; saveAs(new Blob([ dataString ], { type: 'text/plain;charset=utf-8' }), filename, noAutoBOM);