首页 > 解决方案 > 有没有如何在 AG-GRID 上显示行时获取行?

问题描述

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

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

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

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

例如

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

GetRowsAsTheyREALLY 是:

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

标签: angularag-gridag-grid-angular

解决方案


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

前任

 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);
    }
  }

这个


推荐阅读