Trying to get the last column in a Grid to expand

Our grids almost always have height/width set to 100%.
At the same time, we set widths on all columns.

For the last column I’m trying to set a minimum width + an expand ratio, so that it takes all the remaining free space.

This works fine in a small test case, but when I try it in my application, the last column doesn’t initially expand. See attachment.
Only when I do some later change, like resize the window, does it display as it should.

Anyone else experienced something similar?

Tested in 7.5.1 and 7.6.SNAPSHOT


Same here. And it was not there a few days ago. Does it come with 7.5 update?


Can you send us a quick sample code that breaks? It will speed up the investigation process quite significantly. This should work, so it looks like a bad regression, worthy of immediate actions.


Does this look like the same issue?


Yes, this bug looks like the same. But the Grid is inside a VerticalLayout, not a SplitPanel:

        VerticalLayout layout = new VerticalLayout();

        Grid grid = new Grid("Test", new TestContainer());
        layout.setExpandRatio(grid, 1);

It took some time to reproduce, but it seems the problem has to do with the caption…
This example has the problem. If I remove the caption the problem goes away.

package com.example.test_grid_colwidth;

import javax.servlet.annotation.WebServlet;

import com.vaadin.annotations.Theme;
import com.vaadin.annotations.VaadinServletConfiguration;
import com.vaadin.server.VaadinRequest;
import com.vaadin.server.VaadinServlet;
import com.vaadin.ui.Grid;
import com.vaadin.ui.Grid.Column;
import com.vaadin.ui.UI;
import com.vaadin.ui.VerticalLayout;

public class Test_grid_colwidthUI extends UI {

@WebServlet(value = "/*", asyncSupported = true)
@VaadinServletConfiguration(productionMode = false, ui = Test_grid_colwidthUI.class, widgetset = "com.example.test_grid_colwidth.widgetset.Test_grid_colwidthWidgetset")
public static class Servlet extends VaadinServlet {

protected void init(VaadinRequest request) {
    final VerticalLayout layout = new VerticalLayout();

    Grid grid = new Grid("Grid");
    Column col1 = grid.addColumn("Col1");
    Column col2 = grid.addColumn("Col2");


[/code]The problem also goes away if I drop the VerticalLayout and set the grid as the content.
But, then the caption also disappears. I guess that could be a “feature”?
Same happened when I added a grid with caption to a SplitPanel; Columns displayed correctly, but caption didn’t display at all.

If you add a summery row to the grid, the bug is gone. But why?

        Grid.FooterRow footerRow = grid.appendFooterRow();
        Grid.FooterCell footerCell = footerRow.join(grid.getColumns().stream().map(x -> x.getPropertyId()).toArray());
        footerCell.setText("Anzahl: " + container.size());
        container.addItemSetChangeListener(event -> footerCell.setText("Count: " + container.size()));