Grid.setRowHeight() will Apply to both Header and Row?

Currently, I try to set Grid Row height to fit Image Icon display.

I found grid.setRowHeight() method, however, after set Row Height, it applies to both header and data Row.

For Grid I use addComponentColumn method to create Image Display column. will that be the case?


And by the way, it there any method to set Grid.HeaderRow’s height individually?

Any suggestion?

Is your question about FrameWork Grid? It looks like so.

setRowHeight() is global setting.

If you want to impact body rows only, use https://vaadin.com/api/8.1.1/com/vaadin/ui/Grid.html#setStyleGenerator-com.vaadin.ui.StyleGenerator- (Vaadin 8) or https://vaadin.com/api/7.7.10/com/vaadin/ui/Grid.html#setRowStyleGenerator-com.vaadin.ui.Grid.RowStyleGenerator- (Vaadin 7)

See
https://github.com/vaadin/framework/issues/9425
for an enhancement request to make each section (header, body, footer) individually configurable. Note that the setting would still apply to the whole section, so e.g. all header rows would have the same height.

Thanks Tatu Lund and Henri Sara~

I tried grid.setStyleGenerator() method, but looks like no effect at all for setting the Grid body Row height
I also follow the sample code in official tutorial :


grid.setStyleGenerator(person → { return “test1”; });
.v-grid-row.test1 { color: gray; height:100px}

still not work as expect.

Any suggestion?

I have tried to limit the Grid Header’s height
for(Object column : gridComp.getColumns()){
gridComp.getHeaderRow(0).getCell(((Grid.Column)column).getId())
.setStyleName(“heaer_cell1”);
}

.v-grid-header.header_1{ background-color: rgba(255, 42, 37, 0.36); height: 30px !important; }


but still have following

style not been set correctly:

  1. v-grid-scroller v-grid-scroller-vertical →
    top and height
  2. v-grid-header-deco →
    height
  3. v-grid-body →
    margin-top

Any suggestion to directly control the individual

element’s style?

Hi,

Yesterday I made
a patch
that provides separate row height configuration for the different sections in Grid. Once that is merged and we build another 8.1-SNAPSHOT, you should be able to check it out and start using it. The fix will hopefully also make it to 8.1.2.

//Teemu

Teemu Thanks lot ~
Expecting new feature release soon~ :slight_smile: