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, 2 weeks ago
How to make a Grid occupy the rest of Tab's space
Hi all,
I want to add a Grid to a Tab and make the Grid occupy the rest of Tab's space, but setExpandRatio(grid, 1f) does not work. The snapshot is attached. Any help is appreciated.
p.s. I'm using Vaadin 7.6.6
Thanks in advance,
Daniel.Sun
TabSheet tabSheet = new TabSheet();
tabSheet.addTab(createIndexTab(request), "Index");
private VerticalLayout createIndexTab(VaadinRequest request) {
VerticalLayout root = new VerticalLayout();
root.setSizeFull();
TextField textField = new TextField();
textField.setWidth("100%");
root.addComponent(textField);
Grid grid = new Grid();
grid.setWidth("100%");
grid.setHeightMode(HeightMode.CSS);
grid.setHeight("100%");
grid.setSelectionMode(Grid.SelectionMode.SINGLE);
grid.setHeaderVisible(false);
grid.addColumn("item");
for (int i = 0; i < 1000; i++) {
grid.addRow("String" + i);
}
root.addComponent(grid);
root.setExpandRatio(grid, 1f);
root.setHeight("100%");
return root;
}
Last updated on
TabSheet has undefined height? Change it fixed or relative height.
Last updated on
+1
Hi Johannes,
It works! Thanks a lot!
Best regards,
Daniel.Sun
Last updated on
You cannot reply to this thread.