How to autosize the column

Tags: #<Tag:0x00007fa996318b38>


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



Hi @fayejitendra

You can use colWitdhs options -

Here is an updated demo -

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.


So you could calculate the longest value in each column and based on this you could set the colWidths in upadeSettings -

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 -


So you could respond on dynamic value by breaking a condition to more options.
For example in this way -

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