It is possible to provide the data to ag-Grid in a tree structure. This can be used to provide a view of a tree (such as a file browser, this is what the File Browser example does) or you can provide data already grouped (eg maybe you are going the grouping in our database).
To provide data as a tree structure, you should provide a getNodeChildDetails() callback function. The existence of this function tells the grid the data is already structured. When you set data into the grid, the callback function will get called exactly once for each element in the structure. What you should return from the function is as follows:
Below shows a simple example of providing already structured data. Notice that you can also provide data to the group level nodes (Sausage, Spaceman and Winklepicker) - this is where you would put aggregation values or group titles if needed.
Also take a look at the File Browser example for a full example.
Depending on your scroll position the last item's group data may not be visible when clicking on the expand icon.
You can resolve this by using the function api.ensureIndexVisible(). This ensures the index is visible, scrolling the table if needed.