I need to preserve the expanded row state of the Ag-grid in angular having 3 levels of nesting. So, basically the scenario is - I am redirecting to another component through a button which is on level 3 nesting of the aggrid. Now when I return back to the ag-grid, I want to get back to the same expanded state on which I left. Refreshing the page should reset the grid as it was, so something to do with the state in the redux store in angular. I am able to get a solution that involves iterating through all the nodes in aggrid and then expand one, but it is O(n) time complex. Is there a better way to do this?
I tried using the gridoptions.api.setRowExpanded(node, true) while doing a forEach on app the nodes.
But this is really a bad approach taking into consideration the time complexity as the agrid has thousands of nodes.