How to autosize the column

Tags: #<Tag:0x00007efc64cb8268>

Hi,

I want to autosize the table column. Currently I used autoColumnSize: true but even then some extra space is coming.

image

https://jsfiddle.net/6zsc27bf/

Thanks

Hi @fayejitendra

You can use colWitdhs options - https://handsontable.com/docs/7.4.2/Options.html#colWidths

Here is an updated demo - https://jsfiddle.net/bwLzythg/6/

I have many columns, so I dont want to hard code the column width. I want to set auto size for the column width. But I am getting some extra space that I want to remove.

Thanks

So you could calculate the longest value in each column and based on this you could set the colWidths in upadeSettings - http://jsfiddle.net/csymv5uj/

Does it meet your goal?

I dont think this will solve the problem because it will create some other issue.

  1. Performance
  2. as data will be dynamic it will not fit in column - http://jsfiddle.net/bojcpe7f/

Thanks

So you could respond on dynamic value by breaking a condition to more options.
For example in this way - http://jsfiddle.net/obztg20k/

Yes, it could have a negative impact on performance, unfortunately.