vaadin / flow-components

Java counterpart of Vaadin Web Components
101 stars 66 forks source link

Grid joined columns misplaced when a flexgrow + zero whdth column exists #6848

Open mikhail-barg opened 4 days ago

mikhail-barg commented 4 days ago

Description

I'm prepending a "spacing" column to a grid with joined columns, and it breaks the joined header row.

Looks like this: Screenshot 2024-11-21 232339_ Screenshot 2024-11-21 232347

Expected outcome

If I remove the .setWidth("0") line on the "Z" column, it looks as expected: Screenshot 2024-11-21 232318

Minimal reproducible example

@Route("")
public class MainView extends VerticalLayout {

    public final class Dto {
        public String get() { return "value"; }
    }

    public MainView() {

        Grid<Dto> grid = new Grid<>();
        grid.prependHeaderRow(); //initial header
        HeaderRow groupHeaderRow = grid.prependHeaderRow();

        Grid.Column<Dto> z = grid.addColumn(Dto::get)
            .setHeader("Col Z")
            .setWidth("0")      //this line!
            .setFlexGrow(1);
        Grid.Column<Dto> a = grid.addColumn(Dto::get).setHeader("Col A");
        Grid.Column<Dto> b = grid.addColumn(Dto::get).setHeader("Col B");
        groupHeaderRow.join(a, b).setText("Join");

        grid.setSizeFull();
        grid.addThemeVariants(GridVariant.LUMO_COLUMN_BORDERS);
        this.setSizeFull();
        this.add(grid);
    }
}

Steps to reproduce

just run it

Environment

Vaadin version(s): checked on 24.5.5, 24.4.6 OS: Windows 11 Browser: Chrome 131.0.6778.70

Browsers

Chrome, Edge, Issue is not browser related