0

I have a problem when upgrading from Vaadin 23 to Vaadin 24. GridContextMenu component (which is created for Grid inside Dialog) is not displayed. There are no errors.

Environment:

os: Windows 10 Pro (21H2)
browser: chrome-113.0.5672.93, firefox-113.0.1
java: 17.0.3
nodejs: 18.16.0
spring-boot: 3.0.6
vaadin: 24.0.5

Example:

import com.vaadin.flow.component.dialog.Dialog;
import com.vaadin.flow.component.grid.Grid;
import com.vaadin.flow.component.grid.contextmenu.GridContextMenu;
import com.vaadin.flow.component.html.Div;
import com.vaadin.flow.component.html.Label;
import com.vaadin.flow.router.PageTitle;
import com.vaadin.flow.router.Route;

import java.util.List;

@PageTitle("Example-01")
@Route(value = "example01", layout = MainLayout.class)
public class Example01View extends Div {

    public Example01View() {
        add(createGrid());             // GridContextMenu is displayed

        Dialog dialog = new Dialog();
        dialog.add(createGrid());      // GridContextMenu is not displayed

        dialog.open();
    }

    private Grid<Product> createGrid() {
        Grid<Product> grid = new Grid<>(Product.class, false);
        grid.addColumn(Product::id).setHeader("Id");
        grid.addColumn(Product::name).setHeader("Name");

        GridContextMenu<Product> menu = grid.addContextMenu();
        menu.addItem(new Label("Text 1"));
        menu.addItem(new Label("Text 2"));

        grid.setItems(List.of(
                new Product(1L, "name1"),
                new Product(2L, "name2")
        ));

        return grid;
    }

    public record Product(Long id, String name) {
    }
}

The problem is not reproduced in:

  • Vaadin 22.0.x + Spring Boot 2.5.x
  • Vaadin 23.3.x + Spring Boot 2.7.x

Why doesn't it work anymore? How to solve this problem?

Thanks for the help.

ollitietavainen
  • 3,900
  • 13
  • 30
Roman
  • 1

0 Answers0