Important Notice - Forums is archived
To simplify things and help our users to be more productive, we have archived the current forum and focus our efforts on helping developers on Stack Overflow. You can post new questions on Stack Overflow or join our Discord channel.

TUTORIALVaadin lets you build secure, UX-first PWAs entirely in Java.
Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.
Calling javascript synchronously by Enver Haase, 1 month ago
Grid Vaadin 8 can't change row size
I'm working with 8.1 and my own theme but can't figure out how to change the height of the rows, I want 100px. Here is my theme and code.
The cell text does turn red but the row remains at 38px.
Please help. Thanks.
@import "../valo/valo.scss";
@mixin mytheme {
@include valo;
.v-grid-cell-local {
height: 100px;
color: red;
}
.v-grid-row-local {
height: 100px;
color: blue;
}
.v-label-local {
height: 70px;
}
}
@Theme("mytheme")
public class MyUI2 extends UI {
private static final long serialVersionUID = 8710201423597120300L;
@Override
protected void init(VaadinRequest vaadinRequest) {
final VerticalLayout layout = new VerticalLayout();
layout.addComponent(makeGrid());
setContent(layout);
}
ClassResource face = new ClassResource("face.png");
private Grid<User> makeGrid() {
List<User> users = new ArrayList<>();
User u = new User();
u.name = "test test";
u.dayOff = "yes off";
users.add(u);
u = new User();
u.name = "test2 test2";
u.dayOff = "no off";
users.add(u);
u = new User();
u.name = "test3 test3";
u.dayOff = "no off";
users.add(u);
Grid<User> userGrid = new Grid<>("Rate your favorite Countries");
userGrid.setItems(users);
userGrid.addColumn(user -> {
Label l = new Label(user.getName());
l.addStyleName("v-label-local");
return l;
}, new ComponentRenderer()).setCaption("Name").setId("nameId");
userGrid.addColumn(user -> new Label(user.getDayOff()), new ComponentRenderer()).setCaption("Day off").setId("dayOffId");
Column<User, ?> column = userGrid.getColumn("nameId");
column.setStyleGenerator(user -> {
return "v-grid-cell-local";
});
column = userGrid.getColumn("dayOffId");
column.setStyleGenerator(user -> {
return "v-grid-cell-local";
});
userGrid.setStyleGenerator(user -> "v-grid-row-local");
return userGrid;
}
class User{
String name;
String dayOff;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getDayOff() {
return dayOff;
}
public void setDayOff(String dayOff) {
this.dayOff = dayOff;
}
}
@WebServlet(urlPatterns = "/*", name = "MyUIServlet", asyncSupported = true)
@VaadinServletConfiguration(ui = MyUI2.class /* entry point into the UI */, productionMode = true)
public class MyUIServlet extends VaadinServlet {
private static final long serialVersionUID = -6170475567092457100L;
}
}
Last updated on
In version 8.1 there should be a method Grid.setRowHeight for setting the row height programmatically.
Last updated on
You cannot reply to this thread.