dhaval dhaval - 1 month ago 13
Java Question

How do I control column width of the Vaadin Table?

I have a large table to display in one of our Vaadin application. The table has 110 columns with large text header for each column.

On display the table looks awful as all the column header goes off the screen and the header separator loses the alignment with the data record column separator.

I have set the table width to 100% to display the table scrollbar. I tried to set columnExpandRatio as well as column width but no success.

Vaadin table by default sets the text header width as the column width. Is there any way i can set the header/column width to fit my data rather the header?


Finally as a solution I assigned no width value to initial columns (like first 30 columns will span naturally) and later columns with fixed width size with setColumnWidth() and it worked.