Currently, I am utilizing the complimentary Version of ag-Grid within my Angular 4 Application.
In this code snippet below, my intention is to automatically resize the grid within 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();
}
However, when inspecting the Developer Tools, an error message appears as follows:
ERROR TypeError: Cannot read property 'sizeColumnsToFit' of undefined