I want to add conditional edit mode for ag grid so that user can only be allowed to pin /unpin show/hide column from menu after some action button click. I have tried to add "menuTabs" in column definition after action but it is not changing column headers. Please find below my current try
//Initialy. This works fine no column menu visible on grid
this.gridColumns.map((column) => {
column['menuTabs'] = [];
return column;
})
//Conditional. Not working column menu still missing
if (condition) {
this.gridColumns.map((column) => {
column['menuTabs'] = ["generalMenuTab",columnsMenuTab"];
return column;
})
this.gridApi.setColumnDefs(this.gridColumns)
this.gridApi.refreshHeader();
}
Thank you