I am using ag-Grid for displaying the list of user .If i edit the user details,then i want to click update button in grid to edit the corresponding user details.
This is coloumn header in ag_grid
{ headerName: 'Update', field: "update", width: 80, cellRenderer:this.updateRenderFunction}
i am using cell renderer
updateRenderFunction(params){
var eSpan = document.createElement('button');
eSpan.innerHTML = "Update";
var data = params.node.data;
eSpan.addEventListener('click',()=>{
//here i want to call service
})
return eSpan;
}
Try this it worked for me...give bind(this) after updateRenderFunction like below.
{ headerName: 'Update', field: "update", width: 80, cellRenderer:this.updateRenderFunction.bind(this)}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With