Line breaks in DataGrid header

Hi

I’m trying to set line-breaks in DataGrid column headers like it is discussed in this post for Table : Line Breaks in Table Header

For tables it works as intended in my app, filling the purpose of stretching table content breadthwise thus having more columns displayed in the same screen width. This is especially useful when you have lengthy column captions (it happens with french language :slight_smile: ) and content with small width (e.g figures).

image

image

For the grid I used roughly the same trick : css white-space: normal and adding line-breaks after each word in the column headers, with the following code.

        for (Column column : grid.getColumns()) {
            String caption = column.getCaption().replaceAll("\\s+", "\n");
            column.setCaption(caption);
        }

Problem is in Vaadin code with Grid.Column.setCaption(String caption)

image

Calling caption = Jsoup.parse(caption).text() removes linebreaks from the string.

There are ways to make Jsoup not removing linebreaks but it needs to be done within the code of Vaadin Grid which cannot be altered or extended, can it ?

I’m open for guidance here.

CUBA 7.2

Regards
Michael