onTrClick (#23)

* README: correct watch command

* Add onTrClick handler

* react soften peerDependency: ^15.x.x
This commit is contained in:
Dimitry
2017-01-09 21:38:22 +03:00
committed by Tanner Linsley
parent f195b3243d
commit be951a3252
3 changed files with 6 additions and 3 deletions

View File

@@ -96,6 +96,7 @@ These are the default props for the main react component `<ReactTable />`
// Callbacks
onChange: (state, instance) => null, // Anytime the internal state of the table changes, this will fire
onTrClick: (row, event) => null, // Handler for row click events
// Text
previousText: 'Previous',
@@ -290,7 +291,7 @@ If you would like to help develop a suggested feature follow these steps:
- Fork this repo
- `npm install`
- `npm watch`
- `npm run watch`
- Implement your changes to files in the `src/` directory
- Submit PR for review
@@ -300,7 +301,7 @@ If you would like to preview your changes, you can link and utilize the example
- `cd example`
- `npm install`
- `npm link react-table`
- `npm watch`
- `npm run watch`
- Make changes to the example in `src/screens/index.js` if needed
- View changes at `localhost:8000`

View File

@@ -35,7 +35,7 @@
"classnames": "^2.2.5"
},
"peerDependencies": {
"react": "^15.3.1"
"react": "^15.x.x"
},
"devDependencies": {
"babel-cli": "6.14.0",

View File

@@ -23,6 +23,7 @@ export const ReactTableDefaults = {
tbodyClassName: '',
trClassName: '',
trClassCallback: d => null,
onTrClick: () => null,
thClassName: '',
thGroupClassName: '',
tdClassName: '',
@@ -358,6 +359,7 @@ export default React.createClass({
return (
<TrComponent
key={i}
onClick={event => this.props.onTrClick(rowInfo.row, event)}
className={classnames(this.props.trClassName, this.props.trClassCallback(rowInfo))}
style={Object.assign({}, this.props.trStyle, this.props.trStyleCallback(rowInfo))}
>