简体   繁体   中英

ag-grid hidden columns visible after row grouping changed

I have the following issue with setting row groups and hidden columns.

Initially when I fetch the column definitions I set the row groups like below

this.gridOptions.api.setColumnDefs(columnsAndData[0]);
this.gridOptions.columnApi.setRowGroupColumns(this.selectedGroupBy);     / selectedGroupBy is string[]
this.gridOptions.api.setRowData(columnsAndData[1]);

This works fine and any hidden columns in columnDefs are not showing on the grid.

Subsequently when I change the row grouping via below method the hidden columns become visible.

changeGroupBy(): void {
this.gridOptions.columnApi.setRowGroupColumns(this.selectedGroupBy);
this.gridOptions.api.refreshGroupRows(); }

Can you explain this behaviour and why hidden columns are reset to visible again?

Apparently adding a flag to the gridOptions fixes this issue suppressMakeColumnVisibleAfterUnGroup

https://www.ag-grid.com/javascript-grid-grouping

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM