• Helper to be used within popup definitions providing custom widgets to ensure, that the correct content for every feature is shown, if the popup handles multiple feature hits.

    Parameters

    • graphic: Graphic
    • dijit: any
    • triggerUpdate: ((graphic) => void)
        • (graphic): void
        • Parameters

          • graphic: Graphic

          Returns void

    Returns WidgetProxy

    Example

    import ContentUpdateProxy from "./ContentUpdateProxy";

    export default function CustomWidgetPopupDefinition() {
    return {
    resolvePopupTemplate(layer) {
    return {
    outFields: ["objectid", "Name", "Description"],
    title: "This is {Name}",

    // Define a content function
    content({graphic}) {
    let widget = layer._$popup_widget;
    if (!widget) {
    widget = layer._$popup_widget = createWidget();
    // widget is a dijit Widget
    widget.startup();
    }

    // Use the proxy to handle content updates
    // This ensures, that the correct content for every feature is shown,
    // if the popup handles multiple feature hits
    return ContentUpdateProxy(graphic, widget, (graphic) => {
    updateWidgetContent(widget, graphic);
    });
    }
    };
    }
    resolvePopupTemplateForStore(store) {
    // analogue to resolvePopupTemplate(layer)
    }
    cleanupPopupTemplate(layerOrStore) {
    let widget = layerOrStore._$popup_widget;
    delete layerOrStore._$popup_widget;
    widget && widget.destroyRecursive();
    }
    };
    }

Generated using TypeDoc