【问题标题】:Is there how to get rows as it is being displayed on AG-GRID?有没有如何在 AG-GRID 上显示行时获取行?
【发布时间】:2020-05-29 13:30:26
【问题描述】:

我很难在 ag-grid 上实现 MOVE-TO 功能。

目标是在外部输入文本上按回车键后跳转到可见单元格。

目前我正在调用 forEachNodeAfterFilterAndSort 来检索正在显示的行。但是当你开始处理组、orgHierachy、隐藏列等时,就没有那么简单了。

那么,有没有办法在 ag-grid api 上获得类似的东西?

例如

  _________________
  |  A    |  B    |
  -----------------
0)| Loris | Ipsum |
1)|       | foo   |
2)|       | bar   |
  -----------------

GetRowsAsTheyREALLYare:

[
   {index:0, A='Loris', B="Ipsum"},
   {index:1, B="foo"},
   {index:2, B="bar"}
]

【问题讨论】:

    标签: angular ag-grid ag-grid-angular


    【解决方案1】:

    根据 Ag-Gird 文档,使用 getDisplayedRowCount(); 获取可见行。

     getAllDisplayedRows() {
        var count = this.gridApi.getDisplayedRowCount();
           for (var i = 0; i < count; i++) {
          var rowNode = this.gridApi.getDisplayedRowAtIndex(i);
          console.log("row " + i + " is " + rowNode.data);
        }
      }
    

    阅读this

    【讨论】:

    • 这不是重点。 forEachNodeAfterFilterAndSort 已经对迭代器做了同样的事情。问题是,根据您定义 columndefs 的人,DATA 上的某些项目可能不一定可见,例如
    猜你喜欢
    • 2018-11-14
    • 2020-02-24
    • 2017-06-28
    • 2019-08-27
    • 2016-05-07
    • 2016-08-02
    • 2020-05-31
    • 2016-04-15
    • 2019-09-18
    相关资源
    最近更新 更多