@mendix/extensions-api - v0.2.4
    Preparing search index...

    Interface IDialogApi

    API for showing modal dialogs.

    interface IDialogApi {
        _apiId: "mendix.DialogApi";
        addEventListener<K extends never>(
            eventType: K,
            listener: EventHandler<{}, K>,
        ): DisposeListener;
        close(dialogId: string): Promise<void>;
        closeWithResult(dialogId: string, result: unknown): Promise<void>;
        removeEventListener<K extends never>(
            eventType: K,
            listener: EventHandler<{}, K>,
        ): void;
        showModal(dialogInfo: DialogInfo, uiSpec: UISpec): Promise<unknown>;
        update(dialogId: string, dialogState: DialogState): Promise<void>;
    }

    Hierarchy (View Summary)

    Index

    Properties

    _apiId: "mendix.DialogApi"

    Unique identifier that can be used to register or retrieve a specific API.

    Example: mendix.EditorsAPI, mycompany.MyFunkyAPI

    Methods

    • Adds an event listener for the specified event type.

      Type Parameters

      • K extends never

      Parameters

      • eventType: K

        The type of event to listen for.

      • listener: EventHandler<{}, K>

        The event listener to add.

      Returns DisposeListener

      A function that can be called to remove the event listener.

    • Closes an open modal dialog. This method should be called from inside the dialog UI itself. When this method is used to close the dialog, the result of the dialog will be null.

      Parameters

      • dialogId: string

        The unique identifier of the modal dialog to update. This ID is passed to the dialog UI in the dialogId query string parameter.

      Returns Promise<void>

    • Closes an open modal dialog. This method should be called from inside the dialog UI itself. The result of the dialog will be the value passed to this method.

      Parameters

      • dialogId: string

        The unique identifier of the modal dialog to update. This ID is passed to the dialog UI in the dialogId query string parameter.

      • result: unknown

        The result to return when the modal dialog is closed.

      Returns Promise<void>

    • Removes an event listener for the specified event type.

      Type Parameters

      • K extends never

      Parameters

      • eventType: K

        The type of event to remove the listener from.

      • listener: EventHandler<{}, K>

        The event listener to remove.

      Returns void

    • Displays a modal dialog to the user.

      The UI entrypoint of the dialog is specified in the uiSpec parameter. This entrypoint is passed a unique identifier for the dialog in the dialogId query string parameter. The dialogId can be used to identify the dialog when calling the update, close, or closeWithResult methods.

      Parameters

      • dialogInfo: DialogInfo

        An object containing information about the modal dialog, including its configuration and behavior.

      • uiSpec: UISpec

        The UI specification for rendering the modal dialog.

      Returns Promise<unknown>

      A promise that resolves with the result of the modal dialog when it is closed. The result can be of any type, depending on the value passed by the UI when it calls closeWithResult. If the dialog is closed by clicking the close button ('X') in the title bar, the promise resolves with the value null.

    • Updates the state of an open modal dialog.

      Parameters

      • dialogId: string

        The unique identifier of the modal dialog to update. This ID is passed to the dialog UI in the dialogId query string parameter.

      • dialogState: DialogState

        An object containing the state to update for the modal dialog.

      Returns Promise<void>