kintela
kintela

Reputation: 1323

Cannot read property 'api'

I'm trying to define the columns.

import { GridOptions } from "ag-grid-community";
import "ag-grid-enterprise";
......
private gridOptions:GridOptions;
.....here I fill columdDefs
this.gridOptions.api.setColumnDefs(columnDefs);  

but when I execute I get this error.

Unhandled rejection TypeError: Cannot read property 'api' of undefined    at HoursDataTable.defineColumns

Any idea please?
Regards

Upvotes: 1

Views: 262

Answers (1)

kintela
kintela

Reputation: 1323

Solved adding this

this.gridOptions = <GridOptions>{};

Thanks

Upvotes: 1

Related Questions