Column max width on loading

Tags: #<Tag:0x00007efc6575d4c0> #<Tag:0x00007efc6575d380>

When the data is loaded some of the cells may contain text which is very long. This causes the column to be very wide. Is it possible to set max column width for these cases and then let the user resize the columns manually if they want it? So essentially, what I want to achieve is when the table is loaded, no column should be wider than 100px (it can be smaller if the data allows).
I tried setting colWidths property, however, this would set width for all columns.

Thanks!

Hi @SNK

did you try the modifyColWidth hook? It allows to set up a max-width for a column. Here’s an example http://jsfiddle.net/rau98b4s/

1 Like

Hi @aleksandra_budnik

In the example you sent, the users won’t be able to resize the columns more than 150px. But they need to be able to resize it any way they want. The restriction needs to be applied only when the table is populated with the data.

So the only way could be to run updateSettings() in afterChange (when data is loaded initially the source is loadData to set colWidths as a function. But I did not test this approach yet, so it’s more like a tip.