Skip to content

Commit

Permalink
fix #392
Browse files Browse the repository at this point in the history
  • Loading branch information
AllenFang committed Apr 8, 2016
1 parent 400736f commit b1e8d18
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 10 deletions.
4 changes: 2 additions & 2 deletions src/BootstrapTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -383,13 +383,13 @@ class BootstrapTable extends Component {
});
}

handleSelectRow = (row, isSelected) => {
handleSelectRow = (row, isSelected, e) => {
let result = true;
let currSelected = this.store.getSelectedRowKeys();
const rowKey = row[ this.store.getKeyField() ];
const { selectRow } = this.props;
if (selectRow.onSelect) {
result = selectRow.onSelect(row, isSelected);
result = selectRow.onSelect(row, isSelected, e);
}

if (typeof result === 'undefined' || result !== false) {
Expand Down
11 changes: 6 additions & 5 deletions src/TableBody.js
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ class TableBody extends Component {
onRowClick(selectedRow);
}

handleSelectRow = (rowIndex, isSelected) => {
handleSelectRow = (rowIndex, isSelected, e) => {
let selectedRow;
const { data, onSelectRow } = this.props;
data.forEach((row, i) => {
Expand All @@ -201,19 +201,20 @@ class TableBody extends Component {
return false;
}
});
onSelectRow(selectedRow, isSelected);
onSelectRow(selectedRow, isSelected, e);
}

handleSelectRowColumChange = e => {
if (!this.props.selectRow.clickToSelect ||
!this.props.selectRow.clickToSelectAndEditCell) {
this.handleSelectRow(
e.currentTarget.parentElement.parentElement.rowIndex + 1,
e.currentTarget.checked);
e.currentTarget.checked,
e);
}
}

handleEditCell = (rowIndex, columnIndex) => {
handleEditCell = (rowIndex, columnIndex, e) => {
this.editing = true;
if (this._isSelectRowDefined()) {
columnIndex--;
Expand All @@ -231,7 +232,7 @@ class TableBody extends Component {
this.props.cellEdit.mode !== Const.CELL_EDIT_DBCLICK) {
const selected = this.props.selectedRowKeys.indexOf(
this.props.data[rowIndex][this.props.keyField]) !== -1;
this.handleSelectRow(rowIndex + 1, !selected);
this.handleSelectRow(rowIndex + 1, !selected, e);
}
this.setState(stateObj);
}
Expand Down
3 changes: 2 additions & 1 deletion src/TableColumn.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ class TableColumn extends Component {
}
this.props.onEdit(
e.currentTarget.parentElement.rowIndex + 1,
e.currentTarget.cellIndex);
e.currentTarget.cellIndex,
e);
}

render() {
Expand Down
4 changes: 2 additions & 2 deletions src/TableRow.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class TableRow extends Component {
const rowIndex = e.currentTarget.rowIndex + 1;
if (this.props.selectRow) {
if (this.props.selectRow.clickToSelect) {
this.props.onSelectRow(rowIndex, !this.props.isSelected);
this.props.onSelectRow(rowIndex, !this.props.isSelected, e);
} else if (this.props.selectRow.clickToSelectAndEditCell) {
this.clickNum++;
/** if clickToSelectAndEditCell is enabled,
Expand All @@ -23,7 +23,7 @@ class TableRow extends Component {
**/
setTimeout(() => {
if (this.clickNum === 1) {
this.props.onSelectRow(rowIndex, !this.props.isSelected);
this.props.onSelectRow(rowIndex, !this.props.isSelected, e);
}
this.clickNum = 0;
}, 200);
Expand Down

0 comments on commit b1e8d18

Please sign in to comment.