需要获取 ag-grid 中所有组中所有行的计数,并对其进行聚合

Need to get the count of all the rows in all the groups in ag-grid with aggregation on it

我在 ag-grid 中使用分组,我需要获取所有组中存在的所有记录的计数。该组的个体计数已经显示在 () 中组名前面的网格中。 I need the sum of highlighted counts

计数显示为 "eChildCount" ref,我可以使用 jQuery 选择器获取它,但我觉得,它会有点笨拙,因为我需要处理分组和正常情况同样,我正在寻找可以通过直接或间接使用 ag-grid 选项给我结果的任何解决方案。 "forEachNodeAfterFilter(callback)" 提供了一些参考资料,但我不确定它是如何工作的,小代码片段会有很大帮助。

gridOptions.api.getModel().rootNode.allChildrenCount 就是您要找的。 getModel() 有很多关于网格中行的信息可供您使用