From 280c423298881b81516dea2c2cdf7ed334a54cf8 Mon Sep 17 00:00:00 2001 From: AllenFang Date: Sun, 28 Jan 2018 22:09:00 +0800 Subject: [PATCH] fix #180 --- .../src/row-selection/selection-cell.js | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/packages/react-bootstrap-table2/src/row-selection/selection-cell.js b/packages/react-bootstrap-table2/src/row-selection/selection-cell.js index bc7e0c5..bba789e 100644 --- a/packages/react-bootstrap-table2/src/row-selection/selection-cell.js +++ b/packages/react-bootstrap-table2/src/row-selection/selection-cell.js @@ -13,12 +13,13 @@ export default class SelectionCell extends Component { selected: PropTypes.bool, onRowSelect: PropTypes.func, disabled: PropTypes.bool, - rowIndex: PropTypes.number + rowIndex: PropTypes.number, + clickToSelect: PropTypes.bool } constructor() { super(); - this.handleRowClick = this.handleRowClick.bind(this); + this.handleClick = this.handleClick.bind(this); } shouldComponentUpdate(nextProps) { @@ -27,17 +28,19 @@ export default class SelectionCell extends Component { return nextProps.selected !== selected; } - handleRowClick() { + handleClick() { const { mode: inputType, rowKey, selected, onRowSelect, disabled, - rowIndex + rowIndex, + clickToSelect } = this.props; if (disabled) return; + if (clickToSelect) return; const checked = inputType === Const.ROW_SELECT_SINGLE ? true @@ -54,7 +57,7 @@ export default class SelectionCell extends Component { } = this.props; return ( - +