ag-grid documentation provides 2 features Tree Data and Data Update:
- https://www.ag-grid.com/javascript-grid-tree/?framework=all#gsc.tab=0
- https://www.ag-grid.com/javascript-grid-data-update/?framework=all#gsc.tab=0
But I don't understand how am I supposed to perform Data Update over Tree Data
Example: I have following javascript data:
const tvSeries = [
{
season: "Season 1",
episodes: [
{episode: "s1e1"},
{episode: "s1e2"},
{episode: "s1e3"},
]
},
{
season: "Season 2",
episodes: [
{episode: "s2e1"},
{episode: "s2e2"},
{episode: "s2e3"},
]
}
]
And set it to grid via
gridApi.setRowData(tvSeries)
Each season will be grouping row with children rows - its episodes
Now I want to add new episode to first season, so I do
tvSeries[0].episodes.push({episode: "s1e4"})
How should I notify grid about this change? If I call gridApi.setRowData(tvSeries) one more time - entire grid will be redrawn, it's sloppy and not cool. There are useful method
gridApi.updateRowData(rowDataTransaction: RowDataTransaction)
but I cant understand how to describe tree changes in RowDataTransaction