AutoColumnWidth

Tags: #<Tag:0x00007efc6579d930>

Hi,

Sorry, I need help with autocolumnwidth (https://jsfiddle.net/namihihii/x89o30uy/28/)

I saw in the documentations that you can use auto column width depending on the headers with the useHeaders: true, I tried to add the useHeaders options but it’s not working :frowning: (As you can see in the fiddle, I gave the 3rd column a long header and I’m trying to make it show) am I doing something wrong?

Thank you so much!

Hi @namihihii

Where was a method like this nearly 9 years ago, now the useHeaders is a part of the autoColumnSize plugin and it is enabled (set to true) by default.

useHeaders: true (default) https://jsfiddle.net/z5wsLxyj/1/
24

useHeaders: false: https://jsfiddle.net/z5wsLxyj/
03

ps. The use of colWidths cuts the whole column (text in header and in cell) to a given value.

Hi,

I see. So I guess there is no need for me to set the useHeaders on the hot settings.
Thank you so much!

Just another question though, does the autoColumnSize still works if there is no data in the table
(like this https://jsfiddle.net/namihihii/nqjz3bt5/6/)?
It does not auto size but when I click on any of the headers then the column width changes.

In the documentation we specify that

This plugin allows to set column widths based on their widest cells.

So if there are no cells available plugin cannot measure the width and it uses the default cell side (the one that you have when you enable the settings as an empty object https://jsfiddle.net/fhrb53y0/)

@aleksandra_budnik
Got it. Thanks for being such a great help :slight_smile:
Have a great day!

I’m always happy to help, @namihihii Have a great one as well!