Using showColumn

Hi
I am not very clear on how to use the showColumn function.
When I try to call it when I have a hot object like this
hot.showColumn(1)
but I get the error:

Uncaught TypeError: Cannot read property ‘showColumn’ of undefined
at :1:48

What is the correct way to do hide/show of columns dynamically?
thank you

Hi @nogah

You have to access this method via getPlugin and the HiddenColumns plugin like in this example: http://jsfiddle.net/vr9ufgpb/1/

hot.getPlugin('HiddenColumns').showColumn(1);

you also need to enable plugin in your Handsontable settings

hiddenColumns: true,

and unfortunately also every action like this needs the table to be rerendered

hot.render();

so yes, I guess there are few steps that you have to perform to get this method working.

Thank you.
It’s really unclear in the documentation.
You should specify where it’s necessary to include plugins.

You’re right. There are few things that we definitely should add.
Thanks for a suggestion and wish you a sunny day,

Hi, I am trying to use the hide column plugin, but once I try to call hotInstance.getPlugin(‘HiddenColumns’); I am getting undefined, I have already the hiddenColumns: true, on the settings, is there something else I am missing?? thanks

Hi @ccrsoftwarelicenses

This should work fine
Here’s a live demo http://jsfiddle.net/49jae696/

Are you using the vanilla version or a framework?