arunkumar
arunkumar

Reputation: 353

Ag grid to check if column is visible or not

I'm trying to hide/Show columns in Ag grid.

Below is my code for hiding/showing columns

 this.gridOptions.columnApi.setColumnsVisible(["Col1", "Col2"], true);

 this.gridOptions.columnApi.setColumnsVisible(["Col3", "Col4"], false);

How do i find, if the columns are already hidden or visible ? based on the current state of the columns, i need to execute the above code. Please help

Upvotes: 2

Views: 9337

Answers (1)

playtoh
playtoh

Reputation: 391

this.gridOptions.columnApi.getColumn("Col1").visible

Source:

getColumn(colKey): Returns the column with the given 'key'. The key can either be the colId (a string) or the colDef (an object).

Upvotes: 8

Related Questions