I am using the free Version of ag-Grid in my Angular 4 Application.
In the following code I want to resize the grid automatically in the constructor:
constructor(private modalService: NgbModal) {
this.gridOptions = <GridOptions>{};
const columnDefs = [...];
const rowData = [...];
this.gridOptions.columnDefs = columnDefs;
this.gridOptions.rowData = rowData;
this.gridOptions.api.sizeColumnsToFit();
}
But in the Developer-Tools I get the following Error:
ERROR TypeError: Cannot read property 'sizeColumnsToFit' of undefined