Lemar
Lemar

Reputation: 50

Vaadin 10 Dialog doesn't show up

I can't see my Vaadin Dialog which I'm trying to add on a simple Vertical Layout
Here is my code:

Dialog d = new Dialog(new Label("Simple label"));
d.setCloseOnEsc(false);
d.setCloseOnOutsideClick(false);

Button cancelBtn = new Button("Cancel", event ->  {
    d.close();
});

d.add(cancelBtn);
add(d);

I hope anyone can help me :)

Upvotes: 2

Views: 669

Answers (1)

Piotr Wilkin
Piotr Wilkin

Reputation: 3501

Dialog::open

A Dialog is a specific component - it is not normally rendered within the given container, but opens as a popup. Therefore, it has special semantics to make it to render - after creating a dialog, you have to call dialog.open() to make it display.

This is also not specific to Vaadin - in many frameworks, dialogs (and other popups) are displayed in a special manner - it's somewhat of a pattern.

Upvotes: 3

Related Questions