我正在使用 ag-Grid 来显示用户列表。如果我编辑用户详细信息,那么我想单击网格中的更新按钮来编辑相应的用户详细信息。
这是 ag_grid 中的列标题
{ headerName: 'Update', field: "update", width: 80, cellRenderer:this.updateRenderFunction}
我正在使用单元格渲染器
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;
}
最佳答案
试试这个对我有用...像下面这样在 updateRenderFunction 之后给 bind(this)。
{ headerName: 'Update', field: "update", width: 80, cellRenderer:this.updateRenderFunction.bind(this)}
关于angular - 无法通过单元格渲染器选项调用 agGrid(Angular2) 中的服务,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37811677/