Reputation: 13
I want to add a message when I hide a column by ToolPanel
or by columnsMenu
.
How can I know which column is hidden?
I know which columns are hidden only when I load the grid by gridOptions.columnApi.getColumnState()
but I don't know what the method or event is to know in realtime which column I have hidden.
Upvotes: 1
Views: 1199
Reputation: 7358
There is the onColumnVisible event that you can listen to. If I'm reading the event hierarchy correct at the bottom, then you will be given the column or columns that were affected and whether or not they were hidden.
this.gridOptions.onColumnVisible = function (event) {
if (event.visible) {
console.log(event.column.colId + ' was made visible');
} else {
console.log(event.column.colId + ' was hidden')
}
}
Upvotes: 2