Home > Back-end >  How to increase row height in vaadin grid accordingly to data in the cell
How to increase row height in vaadin grid accordingly to data in the cell

Time:01-18

I am consuming data from the list and some list may contain multiple line data, so how that can be reflected in the vaadin grid at runtime.

This is the code

public  Grid GridBasic()  {
    
    grid.removeAllColumns();
    grid.addColumn(TopicConsumedDetails::getPartitionNumber).setHeader("PARTITION ");
    grid.addColumn(TopicConsumedDetails::getOffset).setHeader("OFFSET");
    grid.addColumn(TopicConsumedDetails::getMessage).setHeader("MESSAGE");
    
    grid.setItems(details);

    grid.addThemeVariants(GridVariant.LUMO_WRAP_CELL_CONTENT);
    grid.getColumns().forEach( col -> col.setAutoWidth(true));

    return grid;
}

This just displays all the data in a single line and it requires scrolling left to right.

Vaadin Version :23.3.1

CodePudding user response:

Use the built-in "wrap cell content" variant: image showing expected wrapping behavior

  • Related