Is there something else I need to do to ensure gridOptions.columnApi.setColumnVisible does what it says on the tin? :-
This code is running at runtime on a rendered grid and should just hide the column instantly, but does nothing:-
gridOptions.columnApi.setColumnVisible("the col name", false);
Two possible causes of this:
It's probably the latter - are you perhaps using the header name instead of the field/col id?
For example, if you have this:
var columnDefs = [
{headerName: "Athlete", field: "athlete", width: 200}
];
Then the first parameter would be 'athlete'
, not 'Athlete'
.
You can additionally specify a colId to rule out any conflicts and then use this id in your api call:
var columnDefs = [
{headerName: "Athlete", field: "athlete", width: 200, colId: "athleteCol"}
];
But this isn't normally necessary.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With