AllenFang / AllenFang/react-bootstrap-table

onClick call from within function

Abierto
#2,018 1 comentario 0 reacciones 0 asignados Ver en GitHub
Lenguaje dominante
JavaScript
Estrellas
2.2k
Forks
761
Métricas de merge de PR
Sin PR fusionados en 30 d

Descripción

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.

Guía de contribución

Abrir la guía de contribución

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.