Ganesh Devadiga
Ganesh Devadiga

Reputation: 57

How to set Row height dynamically in vaadin 7 Grid?

I'm creating a vaadin grid with three columns of which one column is having HTML contents. HTML data can be in multiple lines. By default only first line of HTML Data is getting displayed in the Grid.

Below is my code

    Grid grid = new Grid();
    grid.setColumns("C1","C2","C3");
    grid.getColumn("C1").setHeaderCaption("Column 1");
    grid.getColumn("C2").setHeaderCaption("Column 2");
    grid.getColumn("C3").setHeaderCaption("Column 3");
    grid.getColumn("C2").setRenderer(new HtmlRenderer());

    grid.addRow("text1","<p>Line 1 Data</p><p>Line 2 Data</p>","data1");
    grid.addRow("text2","<table><tr><th>Month</th><th>Savings</th></tr><tr><td>January</td><td>$100</td></tr></table>","data2");

And the grid looks like this

How to set the height of rows dynamically based on height of the HTML Data?

I'm using vaadin 7

Upvotes: 0

Views: 1334

Answers (1)

Tatu Lund
Tatu Lund

Reputation: 10633

How to set the height of rows dynamically based on height of the HTML Data?

This feature is not supported in Vaadin 7 or Vaadin 8 Grid. The Grid is based on fixed height rows. In Vaadin 7 you can set the Grid height in your theme (see more info here: https://vaadin.com/forum/thread/14385724), in Vaadin 8.1+ there is also setRowHeight() method in Grid.

Upvotes: 1

Related Questions