Skip to content

Commit

Permalink
Fixed the onCheckboxClick callback for TableRow
Browse files Browse the repository at this point in the history
Updated the onCheckboxClick prop to actually provide the correct
parameters that the documentation stated. It will now provide the row
index, checked value, and change event.
  • Loading branch information
mlaursen committed Feb 7, 2017
1 parent f08077b commit 69fbdd8
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/js/DataTables/TableBody.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@ export default class TableBody extends Component {
...row.props,
index: i,
selected: uncontrolled ? selectedRows[i] : row.props.selected,
onCheckboxClick: e => {
onCheckboxClick: (checked, e) => {
if (row.props.onCheckboxClick) {
row.props.onCheckboxClick(i, e);
row.props.onCheckboxClick(i, checked, e);
}

if (uncontrolled) {
Expand Down
4 changes: 2 additions & 2 deletions src/js/DataTables/TableHeader.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,9 @@ export default class TableHeader extends Component {
const row = React.cloneElement(header, {
...header.props,
selected,
onCheckboxClick(e) {
onCheckboxClick(checked, e) {
if (header.props.onCheckboxClick) {
header.props.onCheckboxClick(e);
header.props.onCheckboxClick(-1, checked, e);
}

if (typeof header.props.selected === 'undefined') {
Expand Down

0 comments on commit 69fbdd8

Please sign in to comment.