I am using react-bootstrap-table to implement table structure in React, I tried to add edit button and onClick function for that but its not working.
My code :
render(){
function test(){
alert("asd");
}
function imgFormatter(cell,row) {
return '<a href="#" onClick="test();"><i class="fa fa-pencil" aria-
hidden="true"></i></a>';
}
return(
<BootstrapTable data={this.state.members} bordered={ false } pagination={ true }>
<TableHeaderColumn isKey dataField='memberid' dataSort>ID</TableHeaderColumn>
<TableHeaderColumn dataField='name' dataSort>Name</TableHeaderColumn>
<TableHeaderColumn dataField='username' dataSort>Username</TableHeaderColumn>
<TableHeaderColumn dataField='email' dataSort>Email</TableHeaderColumn>
<TableHeaderColumn dataField='mobile'>Mobile</TableHeaderColumn>
<TableHeaderColumn dataField='edit' dataFormat={ imgFormatter }>Edit</TableHeaderColumn>
</BootstrapTable>
)
}
Am I implementing correctly? why edit onclick not working ? can anyone know how to add edit button in react-bootstrap-table.