I am trying to implement an AG-grid with simple row grouping and trying to hide the columns that are empty. Is there any way to achieve that?
You can hide a column by setting hide=true
on the Column Definition for that column.
If you want to achieve this dynamically, then you can leverage columnApi.applyColumnState()
:
hideGold() {
this.gridColumnApi.applyColumnState({
state: [{ colId: 'gold', hide: true }],
});
}
See this implemented in the following sample.
Documentation on Column State.