I am trying to find the best table to use with my response applications, and at the moment the reaction table offers everything I need (page numbering, server side control, filtering, sorting, footer row).
However, I cannot select a row. There are no examples that show this.
Some of the things I've tried include trying to set className on a row click. But I can not find the caller in eor t. Also, I don't like this approach, because that’s not how the responsive application should do things.
<ReactTable
...
getTrProps={(state, rowInfo, column, instance) => {
return {
onClick: (e, t) => {
t.srcElement.classList.add('active')
},
style: {
}
}
}}
/>
, , , , "" . .
? , , , ?
!
: , , . , , .
2
, , :
onRowClick(e, t, rowInfo) {
this.setState((oldState) => {
let data = oldState.data.slice();
let copy = Object.assign({}, data[rowInfo.index]);
copy.selected = true;
copy.FirstName = "selected";
data[rowInfo.index] = copy;
return {
data: data,
}
})
}
....
getTrProps={(state, rowInfo, column) => {
return {
onClick: (e, t) => { this.onRowClick(e, t, rowInfo) },
style: {
background: rowInfo && rowInfo.row.selected ? 'green' : 'red'
}
}
}}
"FirstName" "selected", "green"