我怎样才能获得所有行的ag-grid? [英] How can I get all the rows of ag-grid?

查看:777
本文介绍了我怎样才能获得所有行的ag-grid?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

ag-grid提供了一种使用api.getSelectedRows()函数获取选定行的方法.并提供了一种使用api.setRowData([])函数设置所有行的方法. 我正在寻找getAllRows()来返回网格中的所有行.我知道有一种方法可以使用api.forEachNode()等遍历所有行. 有什么办法可以获取整个行数组?

ag-grid provides a way to get selected rows using api.getSelectedRows() function. And provides a way to set all rows using api.setRowData([]) function. I'm looking for something getAllRows() to return all the rows in the grid. I know there is a way to loop through all the rows using api.forEachNode() etc. Is there any way I can get the entire array of rows?

推荐答案

我认为没有这种方法,但是您可以自己制作:

I don't think there is such a method but you can make your own:

getAllRows() {
  let rowData = [];
  this.gridApi.forEachNode(node => rowData.push(node.data));
  return rowData;
}

这篇关于我怎样才能获得所有行的ag-grid?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆