-
Notifications
You must be signed in to change notification settings - Fork 431
Closed
Description
Good morning, I'm trying to put a button in the column that, when clicked, returns me information from that row.
I'm trying something like:
handleTagClick = (row) => {
console.log(row);
}
render() {
const addbutton = (cell, row) => {
return (
<Button onClick={this.handleTagClick(row)}>Ola</Button>
)
}
const columns = [{
dataField: 'id',
text: 'ID:',
hidden: true
},{
dataField: 'pessoa.nome',
text: 'Pessoa:',
sort: true,
filter: textFilter()
}, {
text: 'Ação:',
formatter: addbutton,
}];
<BootstrapTable
id="tableLancamento"
filter={filterFactory()}
noDataIndication="X"
striped keyField='id' data={data} columns={columns}
hover
rowStyle={rowStyle}
/>
That way, the button appears in the column, but when clicked, does not print the console log.
As if the method was not being called.
So I removed the parameters.
Stay like this.
handleTagClick = () => {
console.log("print");
}
const addbutton = (cell, row) => {
return (
<Button onClick={this.handleTagClick}>Ola</Button>
)
}
That way, he printed the console log.
How can I put a button, which returns me line info when clicked?
Metadata
Metadata
Assignees
Labels
No labels