I have a checkbox on every row on my reactable table, which when clicked using a function called _onSelectARow should return all the data on that row, whilst the function fires, I am not getting the data on that, which is what I want to pass on to another redux function. My function is as follows:
_onSelectARow = (index) => {
return(event) => {
let selectrow = this.state.data.MyTableData.slice();
if(event.target.checked){
if(selectrow.indexof(index)==-1){
selectrow.push(index);
}
}
else{
let found = selectrow.indexof(index);
if(found >-1){
selectrow.splice(found,1);
}
}
this.setState({selectrow:selectrow});
Index is passed in on the row of the checkbox by {this._onSelectARow(index)}, and is set when data.map(row,index) is called binding the rows to the table.
The problem I am getting when the function is called, I am not the data of the row, but merely an index, and I cannot see why.
Is someone able to point out where the problem is and how I can fix it, please?
Thanks
Aucun commentaire:
Enregistrer un commentaire