Skip to content

Commit

Permalink
Add Event object to row click and double click
Browse files Browse the repository at this point in the history
   - Add Event as parameter to onRowClick and onRowDoubleClick
  • Loading branch information
Robertmw committed Nov 26, 2017
1 parent fed36fa commit 285aba0
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
8 changes: 4 additions & 4 deletions src/BootstrapTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -734,10 +734,10 @@ class BootstrapTable extends Component {
});
}

handleRowClick = (row, rowIndex, columnIndex) => {
handleRowClick = (row, rowIndex, columnIndex, event) => {
const { options, keyBoardNav } = this.props;
if (options.onRowClick) {
options.onRowClick(row, columnIndex, rowIndex);
options.onRowClick(row, columnIndex, rowIndex, event);
}
if (keyBoardNav) {
let { clickToNav } = typeof keyBoardNav === 'object' ? keyBoardNav : {};
Expand All @@ -754,9 +754,9 @@ class BootstrapTable extends Component {
}
}

handleRowDoubleClick = row => {
handleRowDoubleClick = (row, event) => {
if (this.props.options.onRowDoubleClick) {
this.props.options.onRowDoubleClick(row);
this.props.options.onRowDoubleClick(row, event);
}
}

Expand Down
8 changes: 4 additions & 4 deletions src/TableBody.js
Original file line number Diff line number Diff line change
Expand Up @@ -308,17 +308,17 @@ class TableBody extends Component {
this.props.onRowMouseOver(targetRow, event);
}

handleRowClick = (rowIndex, cellIndex) => {
handleRowClick = (rowIndex, cellIndex, event) => {
const { onRowClick, selectRow } = this.props;
if (Utils.isSelectRowDefined(selectRow.mode)) cellIndex--;
if (this._isExpandColumnVisible()) cellIndex--;
onRowClick(this.props.data[rowIndex - 1], rowIndex - 1, cellIndex);
onRowClick(this.props.data[rowIndex - 1], rowIndex - 1, cellIndex, event);
}

handleRowDoubleClick = rowIndex => {
handleRowDoubleClick = (rowIndex, event) => {
const { onRowDoubleClick } = this.props;
const targetRow = this.props.data[rowIndex];
onRowDoubleClick(targetRow);
onRowDoubleClick(targetRow, event);
}

handleSelectRow = (rowIndex, isSelected, e) => {
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 {
rowClick = e => {
const rowIndex = this.props.index + 1;
const cellIndex = e.target.cellIndex;
if (this.props.onRowClick) this.props.onRowClick(rowIndex, cellIndex);
if (this.props.onRowClick) this.props.onRowClick(rowIndex, cellIndex, e);
const {
selectRow, unselectableRow, isSelected, onSelectRow, onExpandRow, dbClickToEdit
} = this.props;
Expand Down Expand Up @@ -57,7 +57,7 @@ class TableRow extends Component {
e.target.tagName !== 'SELECT' &&
e.target.tagName !== 'TEXTAREA') {
if (this.props.onRowDoubleClick) {
this.props.onRowDoubleClick(this.props.index);
this.props.onRowDoubleClick(this.props.index, e);
}
}
}
Expand Down

0 comments on commit 285aba0

Please sign in to comment.