Select to view content in your preferred language

Editor WebComponent access viewModel.featureTemplatesViewModel.filterFunction

139
0
2 weeks ago
SebastianKrings
Frequent Contributor

Using the old way of the Editor Widget wir used a filter function to exclude specific layers from the "front-page" of the EditorWidget while keeping the ability to still edit features of these layers.

This is how we successfully did that:

    [...]
    this._activeEditor = new Editor({
        view: mapView,
        container: this.canvasId,
        layerInfos
    });

    this._activeEditor.when(() => {
        this.setFeatureTemplatesFilterAsync();
    });
}

private async setFeatureTemplatesFilterAsync() {
    const excludedTitles = await this._schema.getLayerNamesFromKeysAsync([LshLayerKeysEnum.CavePolygons, LshLayerKeysEnum.RoutingPositions]) ?? [];

    this._activeEditor!.viewModel.featureTemplatesViewModel.filterFunction = (item) => {
        return !excludedTitles.some(title => item?.label?.startsWith(title));
    };
}


Now after changing to new web component I am asking myseld how to set the filterFunction or how to access the viewModel.


This is how it currently looks without setting the filterFunction.

 

<arcgis-editor
    reference-element="my-map"
    [layerInfos]="layerInfos()">
</arcgis-editor>

 

 

0 Kudos
0 Replies