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

    Interface IElementSelectorApi

    The API that helps show entity and document selector dialogs.

    async loaded(componentContext: ComponentContext) {
    const studioPro = getStudioProApi(componentContext);
    const elementSelectors = studioPro.ui.elementSelectors;
    const selector = await elementSelectors.selectEntity({ allowNone: true, query: { module: "MyModule" } });
    if (selector.status === "ok") {
    console.log(`entity selected:\n ${JSON.stringify(selector.selected)}`);
    } else {
    console.log(`entity selection ${selector.status}`);
    }
    }
    interface IElementSelectorApi {
        _apiId: "mendix.ElementSelectorApi";
        addEventListener<K extends never>(
            eventType: K,
            listener: EventHandler<{}, K>,
        ): DisposeListener;
        removeEventListener<K extends never>(
            eventType: K,
            listener: EventHandler<{}, K>,
        ): void;
        selectDocument(
            selectorParams?: Selector<DocumentQuery>,
        ): Promise<SelectorResult>;
        selectEntity(
            selectorParams?: Selector<EntityQuery>,
        ): Promise<SelectorResult>;
    }

    Hierarchy (View Summary)

    Index

    Properties

    _apiId: "mendix.ElementSelectorApi"

    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.

    • 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

    • Show a document selector dialog window.

      Parameters

      • OptionalselectorParams: Selector<DocumentQuery>

        Optional parameters to filter the documents shown in the selector and allow to explicitly select "none".

      Returns Promise<SelectorResult>

      The selected document or whether the user chose to return none or canceled the selection dialog.

    • Show an entity selector dialog window.

      Parameters

      • OptionalselectorParams: Selector<EntityQuery>

        Optional parameters to filter the entities shown in the selector and allow to explicitly select "none".

      Returns Promise<SelectorResult>

      The selected entity or whether the user chose to return none or canceled the selection dialog.