diff --git a/packages/react-bootstrap-table2-example/examples/csv/csv-column-formatter.js b/packages/react-bootstrap-table2-example/examples/csv/csv-column-formatter.js
new file mode 100644
index 0000000..3e4c018
--- /dev/null
+++ b/packages/react-bootstrap-table2-example/examples/csv/csv-column-formatter.js
@@ -0,0 +1,80 @@
+/* eslint react/prop-types: 0 */
+import React from 'react';
+
+/* eslint no-unused-vars: 0 */
+import BootstrapTable from 'react-bootstrap-table-next';
+import ToolkitProvider, { CSVExport } from 'react-bootstrap-table2-toolkit';
+import Code from 'components/common/code-block';
+import { productsGenerator } from 'utils/common';
+
+const { ExportCSVButton } = CSVExport;
+const products = productsGenerator();
+
+const columns = [{
+ dataField: 'id',
+ text: 'Product ID'
+}, {
+ dataField: 'name',
+ text: 'Product Name'
+}, {
+ dataField: 'price',
+ text: 'Product Price',
+ csvFormatter: (cell, row, rowIndex) => `$ ${cell}NTD`
+}];
+
+const sourceCode = `\
+import BootstrapTable from 'react-bootstrap-table-next';
+import ToolkitProvider, { CSVExport } from 'react-bootstrap-table2-toolkit';
+
+const { ExportCSVButton } = CSVExport;
+const columns = [{
+ dataField: 'id',
+ text: 'Product ID'
+}, {
+ dataField: 'name',
+ text: 'Product Name'
+}, {
+ dataField: 'price',
+ text: 'Product Price',
+ csvFormatter: (cell, row, rowIndex) => \`$ \${cell}NTD\`
+}];
+
+
+ {
+ props => (
+
+ Export CSV!!
+
+
+
+ )
+ }
+
+`;
+
+export default () => (
+
+
+ {
+ props => (
+
+ Export CSV!!
+
+
+
+ )
+ }
+
+
{ sourceCode }
+
+);
diff --git a/packages/react-bootstrap-table2-example/examples/csv/csv-column-type.js b/packages/react-bootstrap-table2-example/examples/csv/csv-column-type.js
new file mode 100644
index 0000000..b487bd2
--- /dev/null
+++ b/packages/react-bootstrap-table2-example/examples/csv/csv-column-type.js
@@ -0,0 +1,79 @@
+/* eslint react/prop-types: 0 */
+import React from 'react';
+
+import BootstrapTable from 'react-bootstrap-table-next';
+import ToolkitProvider, { CSVExport } from 'react-bootstrap-table2-toolkit';
+import Code from 'components/common/code-block';
+import { productsGenerator } from 'utils/common';
+
+const { ExportCSVButton } = CSVExport;
+const products = productsGenerator();
+
+const columns = [{
+ dataField: 'id',
+ text: 'Product ID'
+}, {
+ dataField: 'name',
+ text: 'Product Name'
+}, {
+ dataField: 'price',
+ text: 'Product Price',
+ csvType: Number
+}];
+
+const sourceCode = `\
+import BootstrapTable from 'react-bootstrap-table-next';
+import ToolkitProvider, { CSVExport } from 'react-bootstrap-table2-toolkit';
+
+const { ExportCSVButton } = CSVExport;
+const columns = [{
+ dataField: 'id',
+ text: 'Product ID'
+}, {
+ dataField: 'name',
+ text: 'Product Name'
+}, {
+ dataField: 'price',
+ text: 'Product Price',
+ csvType: Number
+}];
+
+
+ {
+ props => (
+
+ Export CSV!!
+
+
+
+ )
+ }
+
+`;
+
+export default () => (
+
+
+ {
+ props => (
+
+ Export CSV!!
+
+
+
+ )
+ }
+
+
{ sourceCode }
+
+);
diff --git a/packages/react-bootstrap-table2-example/examples/csv/custom-csv-button.js b/packages/react-bootstrap-table2-example/examples/csv/custom-csv-button.js
new file mode 100644
index 0000000..6977995
--- /dev/null
+++ b/packages/react-bootstrap-table2-example/examples/csv/custom-csv-button.js
@@ -0,0 +1,97 @@
+/* eslint react/prop-types: 0 */
+import React from 'react';
+
+import BootstrapTable from 'react-bootstrap-table-next';
+import ToolkitProvider from 'react-bootstrap-table2-toolkit';
+import Code from 'components/common/code-block';
+import { productsGenerator } from 'utils/common';
+
+const products = productsGenerator();
+
+const columns = [{
+ dataField: 'id',
+ text: 'Product ID'
+}, {
+ dataField: 'name',
+ text: 'Product Name'
+}, {
+ dataField: 'price',
+ text: 'Product Price'
+}];
+
+const sourceCode = `\
+import BootstrapTable from 'react-bootstrap-table-next';
+import ToolkitProvider from 'react-bootstrap-table2-toolkit';
+
+const columns = [{
+ dataField: 'id',
+ text: 'Product ID'
+}, {
+ dataField: 'name',
+ text: 'Product Name'
+}, {
+ dataField: 'price',
+ text: 'Product Price'
+}];
+
+const MyExportCSV = (props) => {
+ const handleClick = () => {
+ props.onExport();
+ };
+ return (
+
+
+
+ );
+};
+
+
+ {
+ props => (
+
+
+
+
+
+ )
+ }
+
+`;
+
+const MyExportCSV = (props) => {
+ const handleClick = () => {
+ props.onExport();
+ };
+ return (
+
+
+
+ );
+};
+
+export default () => (
+
+
+ {
+ props => (
+
+
+
+
+
+ )
+ }
+
+
{ sourceCode }
+
+);
diff --git a/packages/react-bootstrap-table2-example/examples/csv/custom-csv-header.js b/packages/react-bootstrap-table2-example/examples/csv/custom-csv-header.js
new file mode 100644
index 0000000..284e7ac
--- /dev/null
+++ b/packages/react-bootstrap-table2-example/examples/csv/custom-csv-header.js
@@ -0,0 +1,83 @@
+/* eslint react/prop-types: 0 */
+import React from 'react';
+
+import BootstrapTable from 'react-bootstrap-table-next';
+import ToolkitProvider, { CSVExport } from 'react-bootstrap-table2-toolkit';
+import Code from 'components/common/code-block';
+import { productsGenerator } from 'utils/common';
+
+const { ExportCSVButton } = CSVExport;
+const products = productsGenerator();
+
+const columns = [{
+ dataField: 'id',
+ text: 'Product ID',
+ csvText: 'CSV Product ID'
+}, {
+ dataField: 'name',
+ text: 'Product Name',
+ csvText: 'CSV Product Name'
+}, {
+ dataField: 'price',
+ text: 'Product Price',
+ csvText: 'CSV Product price'
+}];
+
+const sourceCode = `\
+import BootstrapTable from 'react-bootstrap-table-next';
+import ToolkitProvider, { CSVExport } from 'react-bootstrap-table2-toolkit';
+
+const { ExportCSVButton } = CSVExport;
+const columns = [{
+ dataField: 'id',
+ text: 'Product ID',
+ csvText: 'CSV Product ID'
+}, {
+ dataField: 'name',
+ text: 'Product Name',
+ csvText: 'CSV Product Name'
+}, {
+ dataField: 'price',
+ text: 'Product Price',
+ csvText: 'CSV Product price'
+}];
+
+
+ {
+ props => (
+
+ Export CSV!!
+
+
+
+ )
+ }
+
+`;
+
+export default () => (
+
+
+ {
+ props => (
+
+ Export CSV!!
+
+
+
+ )
+ }
+
+
{ sourceCode }
+
+);
diff --git a/packages/react-bootstrap-table2-example/examples/csv/custom-csv.js b/packages/react-bootstrap-table2-example/examples/csv/custom-csv.js
new file mode 100644
index 0000000..a78d8b0
--- /dev/null
+++ b/packages/react-bootstrap-table2-example/examples/csv/custom-csv.js
@@ -0,0 +1,82 @@
+/* eslint react/prop-types: 0 */
+import React from 'react';
+
+import BootstrapTable from 'react-bootstrap-table-next';
+import ToolkitProvider, { CSVExport } from 'react-bootstrap-table2-toolkit';
+import Code from 'components/common/code-block';
+import { productsGenerator } from 'utils/common';
+
+const { ExportCSVButton } = CSVExport;
+const products = productsGenerator();
+
+const columns = [{
+ dataField: 'id',
+ text: 'Product ID'
+}, {
+ dataField: 'name',
+ text: 'Product Name'
+}, {
+ dataField: 'price',
+ text: 'Product Price'
+}];
+
+const sourceCode = `\
+import BootstrapTable from 'react-bootstrap-table-next';
+import ToolkitProvider, { CSVExport } from 'react-bootstrap-table2-toolkit';
+
+const { ExportCSVButton } = CSVExport;
+const columns = [{
+ dataField: 'id',
+ text: 'Product ID'
+}, {
+ dataField: 'name',
+ text: 'Product Name'
+}, {
+ dataField: 'price',
+ text: 'Product Price'
+}];
+
+
+ {
+ props => (
+
+ Export CSV!!
+
+
+
+ )
+ }
+
+`;
+
+export default () => (
+
+
+ {
+ props => (
+
+ Export CSV!!
+
+
+
+ )
+ }
+
+
{ sourceCode }
+
+);
diff --git a/packages/react-bootstrap-table2-example/examples/csv/hide-column.js b/packages/react-bootstrap-table2-example/examples/csv/hide-column.js
new file mode 100644
index 0000000..4f7d05a
--- /dev/null
+++ b/packages/react-bootstrap-table2-example/examples/csv/hide-column.js
@@ -0,0 +1,79 @@
+/* eslint react/prop-types: 0 */
+import React from 'react';
+
+import BootstrapTable from 'react-bootstrap-table-next';
+import ToolkitProvider, { CSVExport } from 'react-bootstrap-table2-toolkit';
+import Code from 'components/common/code-block';
+import { productsGenerator } from 'utils/common';
+
+const { ExportCSVButton } = CSVExport;
+const products = productsGenerator();
+
+const columns = [{
+ dataField: 'id',
+ text: 'Product ID'
+}, {
+ dataField: 'name',
+ text: 'Product Name',
+ csvExport: false
+}, {
+ dataField: 'price',
+ text: 'Product Price'
+}];
+
+const sourceCode = `\
+import BootstrapTable from 'react-bootstrap-table-next';
+import ToolkitProvider, { CSVExport } from 'react-bootstrap-table2-toolkit';
+
+const { ExportCSVButton } = CSVExport;
+const columns = [{
+ dataField: 'id',
+ text: 'Product ID'
+}, {
+ dataField: 'name',
+ text: 'Product Name',
+ csvExport: false
+}, {
+ dataField: 'price',
+ text: 'Product Price'
+}];
+
+
+ {
+ props => (
+
+ Export CSV!!
+
+
+
+ )
+ }
+
+`;
+
+export default () => (
+
+
+ {
+ props => (
+
+ Export CSV!!
+
+
+
+ )
+ }
+
+
{ sourceCode }
+
+);
diff --git a/packages/react-bootstrap-table2-example/examples/csv/index.js b/packages/react-bootstrap-table2-example/examples/csv/index.js
index e8069c1..5c940cc 100644
--- a/packages/react-bootstrap-table2-example/examples/csv/index.js
+++ b/packages/react-bootstrap-table2-example/examples/csv/index.js
@@ -2,10 +2,11 @@
import React from 'react';
import BootstrapTable from 'react-bootstrap-table-next';
-import ToolkitContext, { CSVExport } from 'react-bootstrap-table2-toolkit';
+import ToolkitProvider, { CSVExport } from 'react-bootstrap-table2-toolkit';
import Code from 'components/common/code-block';
import { productsGenerator } from 'utils/common';
+const { ExportCSVButton } = CSVExport;
const products = productsGenerator();
const columns = [{
@@ -21,9 +22,9 @@ const columns = [{
const sourceCode = `\
import BootstrapTable from 'react-bootstrap-table-next';
-import ToolkitContext, { Search } from 'react-bootstrap-table2-toolkit';
+import ToolkitProvider, { CSVExport } from 'react-bootstrap-table2-toolkit';
-const { SearchBar, searchFactory } = Search;
+const { ExportCSVButton } = CSVExport;
const columns = [{
dataField: 'id',
text: 'Product ID'
@@ -35,52 +36,42 @@ const columns = [{
text: 'Product Price'
}];
-
-
- {
- props => (
-
-
Input something at below input field:
-
-
-
-
- )
- }
-
-
+ {
+ props => (
+
+ Export CSV!!
+
+
+
+ )
+ }
+
`;
export default () => (
-
-
- {
- props => (
-
-
Input something at below input field:
-
-
-
-
- )
- }
-
-
+ {
+ props => (
+
+ Export CSV!!
+
+
+
+ )
+ }
+
{ sourceCode }
);
diff --git a/packages/react-bootstrap-table2-example/stories/index.js b/packages/react-bootstrap-table2-example/stories/index.js
index 04d589e..eee2c87 100644
--- a/packages/react-bootstrap-table2-example/stories/index.js
+++ b/packages/react-bootstrap-table2-example/stories/index.js
@@ -135,6 +135,12 @@ import CustomSearchValue from 'examples/search/custom-search-value';
// CSV
import ExportCSV from 'examples/csv';
+import CSVFormatter from 'examples/csv/csv-column-formatter';
+import CustomCSVHeader from 'examples/csv/custom-csv-header';
+import HideCSVColumn from 'examples/csv/hide-column';
+import CSVColumnType from 'examples/csv/csv-column-type';
+import CustomCSVButton from 'examples/csv/custom-csv-button';
+import CustomCSV from 'examples/csv/custom-csv';
// loading overlay
import EmptyTableOverlay from 'examples/loading-overlay/empty-table-overlay';
@@ -293,7 +299,13 @@ storiesOf('Table Search', module)
.add('Custom Search Value', () => );
storiesOf('Export CSV', module)
- .add('Basic Export CSV', () => );
+ .add('Basic Export CSV', () => )
+ .add('Format CSV Column', () => )
+ .add('Custom CSV Header', () => )
+ .add('Hide CSV Column', () => )
+ .add('CSV Column Type', () => )
+ .add('Custom CSV Button', () => )
+ .add('Custom CSV', () => );
storiesOf('EmptyTableOverlay', module)
.add('Empty Table Overlay', () => )