AllenFang / AllenFang/react-bootstrap-table
onClick call from within function
- Linguagem predominante
- JavaScript
- Estrelas
- 2.2k
- Forks
- 761
- Métricas de merge de PRs
- Nenhum PR com merge em 30d
Descrição
I have the following code:
```
class ModelsSearch extends CustomTable {
constructor(props) {
super(props);
this.handleDelete = this.handleDelete.bind(this);
this.columns = [
{ width: "5%", path: "id", title: "ID", sort: true, isKey: true},
{ width: "10%", path: "name", title: "Name"},
{ width: "20%", path: "description", title: "Description"},
{ width: "10%", path: "", title: "Actions" , dataFormat: this.modelActions }
];
}
handleDelete() {
console.log("On Click Worked");
}
modelActions(cell, row, extra, index){
return (
{_.get(row, "used") === true ?
:
}
);
}
render() {
return (
{this.renderTableColumns()}
);
}
}
```
I am having considerable difficulty with the onClick call for handleDelete. When I try with the above code I get ```Uncaught TypeError: this.handleDelete is not a function```. I've tried a number of different approaches such as the following changes:
```onClick={() => this.handleDelete()}```
```revenueModelActions = (cell, row, extra, index) => {```
but as yet have been unable to get it working. Any advice is appreciated.
Guia de contribuição
Avaliação
Esta issue ainda não foi avaliada.