Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

agGroupCellRenderer not found

I upgraded the ag-grid & ag-grid-react to 14.2.0, but I still get this warning:

ag-grid: Looking for component [agGroupCellRenderer] but it wasn't found.

My column definitions:

let columnDefs = [
    {headerName: 'Name', field: 'userName', width:163, cellRenderer:'agGroupCellRenderer'},
    {headerName: 'Job Title', field: 'jobTitle', width:143},
]

What am I missing here?

like image 411
krishna sinha Avatar asked Jan 02 '23 21:01

krishna sinha


2 Answers

To those who have this message "ag-Grid: Looking for component" with Angular 8, check to see if you have it referenced on your HTML page. In my code, I was missing some reference code in the HTML file. Here is a rough example that could help someone:

EXAMPLE

Component File:

import { AgGroupCellRendererComponent } from 
'../../global/components/agGroupCellRenderer.component';

columnDefs= [{headerName: 'Name', field: 'userName', width:163, 
cellRenderer:'agGroupCellRenderer'}]

frameworkComponents: any;
constructor() {
    this.frameworkComponents = {
      agGroupCellRenderer: AgGroupCellRendererComponent,
    };
}

HTML File:

<ag-grid-angular
  style="width: 100%; height: 500px;"
  class="ag-theme-balham"
  [gridOptions]="gridOptions"
  [rowData]="rowData"
  [frameworkComponents]="frameworkComponents"
> 
like image 60
Mr. Green Avatar answered Jan 06 '23 14:01

Mr. Green


I think you should use components property for mapping string(agGroupCellRenderer) to angular component(AgGroupCellRendererComponent)

gridOptions = {
    ... 
    components: {
        agGroupCellRenderer: AgGroupCellRendererComponent
    }
}

More information here https://www.ag-grid.com/javascript-grid-cell-rendering/

like image 24
CREZi Avatar answered Jan 06 '23 15:01

CREZi