Right now i managed to render to columnheader for all columns (See Screenshot). But my goal is to apply the cell renderer only for 1 SPECIFIC column. I am using Angular 5 and ag-grid/ag-grid-angular 17.0.0
My parent component looks like (For the sake of simplicity i cut the irrelevant thing out):
export class ClanModalComponent implements OnChanges {
@Input() clanInfo: ClansByClantagType;
rowData: ClanMembersType[];
columnDefs;
frameworkComponents;
constructor(private router: Router) {
this.columnDefs = [
{headerName: 'Tag', field: 'tag', width: 120 },
{headerName: 'Name', field: 'name', width: 170 },
{headerName: 'Role', field: 'role', width: 120},
{headerName: 'Level', field: 'expLevel', width: 80},
{headerName: 'Home', field: 'trophies', width: 120},
{headerName: 'Trophies Night', field: 'versusTrophies', width: 120}
];
this.frameworkComponents = { agColumnHeader: TrophiesHomeCellRendererComponent };
ngOnChanges(): void {
if (this.clanInfo) {
this.rowData = this.clanInfo.memberList;
}
}
}
And my cellRenderer component looks like this:
@Component({
selector: 'app-trophy-home',
template: `<img [src]="trophyHomeImg" width="25px" height="auto">`
})
export class TrophiesHomeCellRendererComponent implements AgRendererComponent {
public trophyHomeImg = 'expected/image/path';
agInit() {}
refresh(){
return false;
}
}