Skip to content
This repository has been archived by the owner on Jan 15, 2022. It is now read-only.

add onRowClick prop to Table #362

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion build/reactable.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ window.ReactDOM["default"] = window.ReactDOM;
pageButtonLimit: true,
childNode: true,
data: true,
children: true
children: true,
onRowClick: true
};

function filterPropsFrom(baseProps) {
Expand Down Expand Up @@ -1455,6 +1456,10 @@ window.ReactDOM["default"] = window.ReactDOM;
}
}

if (this.props.onRowClick) {
props.onClick = this.props.onRowClick.bind(null, data);
}

return _react['default'].createElement(_tr.Tr, _extends({ columns: columns, key: i, data: data }, props));
}).bind(this)));
}
Expand Down
3 changes: 2 additions & 1 deletion lib/reactable/lib/filter_props_from.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ var internalProps = {
pageButtonLimit: true,
childNode: true,
data: true,
children: true
children: true,
onRowClick: true
};

function filterPropsFrom(baseProps) {
Expand Down
4 changes: 4 additions & 0 deletions lib/reactable/table.js
Original file line number Diff line number Diff line change
Expand Up @@ -462,6 +462,10 @@ var Table = (function (_React$Component) {
}
}

if (this.props.onRowClick) {
props.onClick = this.props.onRowClick.bind(null, data);
}

return _react2['default'].createElement(_tr.Tr, _extends({ columns: columns, key: i, data: data }, props));
}).bind(this)));
}
Expand Down
4 changes: 2 additions & 2 deletions src/reactable/lib/filter_props_from.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ const internalProps = {
pageButtonLimit: true,
childNode: true,
data: true,
children: true
children: true,
onRowClick: true
};

export function filterPropsFrom(baseProps) {
Expand All @@ -40,4 +41,3 @@ export function filterPropsFrom(baseProps) {

return props;
}

4 changes: 4 additions & 0 deletions src/reactable/table.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -423,6 +423,10 @@ export class Table extends React.Component {
}
}

if (this.props.onRowClick) {
props.onClick = this.props.onRowClick.bind(null, data);
}

return (
<Tr columns={columns} key={i} data={data} {...props} />
);
Expand Down