Ag-grid: iteratively need to selectNode or select rows for 10,000 records in a tree grid
<p>tree node structure:  </p>

<pre><code>{
  proto: {},
  allChildrenCount: 504,
  childIndex: 0,
  children: [],
  childrenAfterFilter: [],
  childrenAfterSort: [],
  description: "Google",
  expanded: false,
  firstChild: true,
  group: true,
  id: 1,
  keyId: "100047832",
  lastChild: false,
  level: 1,
  name: "Google",
  parent: {},
  rowHeight: 25,
  rowTop: 25,
}
</code></pre>

<p>In above, I am creating tree of n-number of nodes where parent as given above node i.e. company name: google which having 504 dept or 504 child companies.
I am populating whole tree structure in a grid, but to select all nodes iteratively:
code:</p>

<pre><code>$scope.gridOptions.api.forEachNode(function (node) {
    $scope.gridOptions.api.selectNode(node, true);
});
</code></pre>

<p>Time taken to select all: 1 min.</p>

<p>could you please suggest a better way to iterate and reduce the time to select n-number of nodes in ag-grid.Thanks in advance.</p>