Ag-Grid:编译错误 [ts] 类型“IRowModel”上不存在属性“rowsToDisplay”

Hen*_*rix 5 ag-grid

我在我的 Angular 项目中使用 Ag-grid。

下面是代码:

var displayModel = this.gridOptions.api.getModel();
var rowNode = displayModel.rowsToDisplay[params.rowIndex];
Run Code Online (Sandbox Code Playgroud)

错误被抛出rowsToDisplay

TS2339: Property 'rowsToDisplay' does not exist on type 'IRowModel'.
Run Code Online (Sandbox Code Playgroud)

我能够成功运行它,但无法编译。

我错过了导入任何东西吗?我正在使用 v17 的 ag-grid 社区版本。

分享一些背景

我使用 rowsToDisplay,因为我想在排序后按索引获取行数据。原版gridOptions.api.getRowNode对我不起作用,因为它没有考虑sorting哪个会重新排列索引号...如果我错了,请纠正我。

小智 1

ag-grid 开发团队未修复此问题https://github.com/ag-grid/ag-grid/issues/2677gridOptions我的建议是从组件中的属性中 删除任何类型,或将其设置为任何类型。