Inline cellRenderer should be used only for simple cases.
To achieve button-click handling inside own cellRenderer you need to create component for that.
Your component would be like that:
@Component({
selector: 'custom-button-cell',
template: `<button [disabled]="!params.node.data.enableButton" (click)="handleClick()">{{params.value}}</button>`,
styles: [``]
})
export class ConditionalRenderer implements ICellRendererAngularComp {
private params: any;
agInit(params: any): void {
this.params = params;
}
refresh(): boolean {
return true;
}
handleClick() {
alert(`Clicked: ${this.params.value}`);
}
}
Here is worked plnkr
Don't forget, that your component should be included to frameworkComponents inside gridOptions or as [frameworkComponents] html attribute.