From 0f2e6b7735e423586f31b80a091a173fd7bf952a Mon Sep 17 00:00:00 2001 From: AllenFang Date: Thu, 28 Apr 2016 21:04:15 +0800 Subject: [PATCH] fix #426 --- src/BootstrapTable.js | 8 +++++++- src/Const.js | 2 ++ src/toolbar/ToolBar.js | 11 ++++++++--- 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/src/BootstrapTable.js b/src/BootstrapTable.js index 33d27cdd4..f6dc86090 100644 --- a/src/BootstrapTable.js +++ b/src/BootstrapTable.js @@ -659,6 +659,8 @@ class BootstrapTable extends Component { columns={ columns } searchPlaceholder={ this.props.searchPlaceholder } exportCSVText={ this.props.options.exportCSVText } + insertText={ this.props.options.insertText } + deleteText={ this.props.options.deleteText } ignoreEditable={ this.props.options.ignoreEditable } onAddRow={ this.handleAddRow } onDropRow={ this.handleDropRow } @@ -826,7 +828,9 @@ BootstrapTable.propTypes = { firstPage: PropTypes.string, lastPage: PropTypes.string, searchDelayTime: PropTypes.number, - exportCSVText: PropTypes.text, + exportCSVText: PropTypes.string, + insertText: PropTypes.string, + deleteText: PropTypes.string, ignoreEditable: PropTypes.bool }), fetchInfo: PropTypes.shape({ @@ -902,6 +906,8 @@ BootstrapTable.defaultProps = { lastPage: Const.LAST_PAGE, searchDelayTime: undefined, exportCSVText: Const.EXPORT_CSV_TEXT, + insertText: Const.INSERT_BTN_TEXT, + deleteText: Const.DELETE_BTN_TEXT, ignoreEditable: false }, fetchInfo: { diff --git a/src/Const.js b/src/Const.js index 008e57192..dada78d5e 100644 --- a/src/Const.js +++ b/src/Const.js @@ -19,6 +19,8 @@ export default { SHOW_ONLY_SELECT: 'Show Selected Only', SHOW_ALL: 'Show All', EXPORT_CSV_TEXT: 'Export to CSV', + INSERT_BTN_TEXT: 'New', + DELETE_BTN_TEXT: 'Delete', FILTER_DELAY: 500, FILTER_TYPE: { TEXT: 'TextFilter', diff --git a/src/toolbar/ToolBar.js b/src/toolbar/ToolBar.js index 7e033e8de..13729f0a3 100644 --- a/src/toolbar/ToolBar.js +++ b/src/toolbar/ToolBar.js @@ -192,7 +192,7 @@ class ToolBar extends Component { className='btn btn-info react-bs-table-add-btn' data-toggle='modal' data-target={ '.' + this.modalClassName }> - New + { this.props.insertText } ); } @@ -205,7 +205,7 @@ class ToolBar extends Component { data-placement='right' title='Drop selected row' onClick={ this.handleDropRowBtnClick }> - Delete + { this.props.deleteText } ); } @@ -372,6 +372,8 @@ ToolBar.propTypes = { columns: PropTypes.array, searchPlaceholder: PropTypes.string, exportCSVText: PropTypes.string, + insertText: PropTypes.string, + deleteText: PropTypes.string, clearSearch: PropTypes.bool, ignoreEditable: PropTypes.bool }; @@ -382,7 +384,10 @@ ToolBar.defaultProps = { enableSearch: false, enableShowOnlySelected: false, clearSearch: false, - ignoreEditable: false + ignoreEditable: false, + exportCSVText: Const.EXPORT_CSV_TEXT, + insertText: Const.INSERT_BTN_TEXT, + deleteText: Const.DELETE_BTN_TEXT }; export default ToolBar;