无法读取属性'api'

问题描述 投票:1回答:1

我正在尝试定义列。

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

但是当我执行时,我得到了这个错误。

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

有什么好主意吗? 问候

aurelia ag-grid
1个回答
1
投票

解决了添加这个

this.gridOptions = <GridOptions>{};

谢谢

© www.soinside.com 2019 - 2024. All rights reserved.