jsComponent in Dialog

Hello.
Is it possible to add a jsComponent to a Dialog? And if not, if the opportunity to create your own dialog box?

Hello!

Dialogs does not provide ability to add custom layout. But you create the screen that can be opened as dialog. You can configure dialog parameters using @DialogMode annotation:

@DialogMode(width = "640px", height = "480px", resizable = true)
@UiController("DemoScreen")
@UiDescriptor("demo-screen.xml")
public class DemoScreen extends Screen {

Or in the XML:

<window xmlns="http://jmix.io/schema/ui/window"
        caption="msg://demoScreen.caption">
    <dialogMode width="640px" height="480px" resizable="true"/>
    <layout spacing="true">
        ...
    </layout>
</window>

Open the screen:

@Autowired
private ScreenBuilders screenBuilders;

@Subscribe("openBtn")
public void onOpenBtnClick(Button.ClickEvent event) {
    screenBuilders.screen(this)
            .withScreenClass(DemoScreen.class)
            .withOpenMode(OpenMode.DIALOG)
            .show();
}

The documnetation about DialogMode: 3.5.1.1.1. Screen Controller Annotations.

1 Like