【问题标题】:Ag-Grid: Compilation Error [ts] Property 'rowsToDisplay' does not exist on type 'IRowModel'Ag-Grid:编译错误 [ts] 属性 'rowsToDisplay' 在类型 'IRowModel' 上不存在
【发布时间】:2020-05-09 01:17:12
【问题描述】:

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

下面是代码:

var displayModel = this.gridOptions.api.getModel();
var rowNode = displayModel.rowsToDisplay[params.rowIndex];

rowsToDisplay 处抛出错误

TS2339: Property 'rowsToDisplay' does not exist on type 'IRowModel'.

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

我是否错过了导入任何内容?我正在使用 v17 的 ag-grid 社区版。

分享一些背景

我使用 rowsToDisplay,因为我想在排序后通过索引获取行数据。原来的gridOptions.api.getRowNode 对我不起作用,因为它不考虑sorting 这将重新排列索引号......如果我错了,请纠正我。

【问题讨论】:

  • 在 plunk 或 stackblitz 上重现您的问题,以便其他人可以轻松地帮助您。还经历了如何创建minimal reproducible example
  • 嗨。我见过类似的问题。尝试添加as ClientSideRowModel(它给出了一个错误,所以通过as any as ClientSideRowModel破解了它。无论如何!如果你觉得它很有趣,请点赞;)。

标签: ag-grid


【解决方案1】:

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2018-11-30
    • 2021-01-11
    • 2021-01-10
    • 1970-01-01
    • 2022-11-30
    • 2020-07-05
    • 1970-01-01
    相关资源
    最近更新 更多