Reputation: 17783
is it possible to configure agGrid grouping so that it behaves like an accordion i.e. only one group can be expanded and when opening new group previously opened is closed?
Upvotes: 0
Views: 1049
Reputation: 11570
Not sure if this answers your question, but I am sure this might be the only direction you'll have.
There is a method provided on gridApi
- onGroupExpandedOrCollapsed
So I think (again, need to check) that this function would be called as its name suggests, and you can collapse the other rows (whichever is opened) and achieve your functionality.
Be cautious while using this as there is comment given by ag-grid
we don't really want the user calling this if one one rowNode was expanded, instead they should be calling rowNode.setExpanded(boolean) - this way we do a 'keepRenderedRows=false' so that the whole grid gets refreshed again - otherwise the row with the rowNodes that were changed won't get updated, and thus the expand icon in the group cell won't get 'opened' or 'closed'.
Upvotes: 1