0

I wrote this code (below) to use the Editor widget of Arcgis API for JavaScript, knowing that before this code I defined my featurelayers (links to shapfiles uploaded on Arcgis server online Arcgis for developers (layers)) by this code I wanted to access all my layers(to edit, add and delete), finally the Editor widget works fine only for a day (I can update my data, delete,add yesterday), but now when I run it, it doesn't work and when I use Insepct element (development tools of google chrome), I find this error in the console:

Uncaught (in promise) TypeError: view.map.loadAll is not a function at index.html: 410

How to do to get rid of this error message?

view.when(() => {
    view.map.loadAll().then(() => {
        view.map.allLayers.forEach((layer) => {
            if (layer.type === "feature") {
                switch (layer.geometryType) {
                    case "polygon":
                        polygonLayer = layer;
                        break;
                    case "polyline":
                        lineLayer = layer;
                        break; 
                    case "point":
                        pointLayer = layer;
                        break;
                }
            }
        })
    })
});

1 Answer 1

2

The "map" property of the view returns a Map, which doesn't have a loadAll method. That method is for a WebMap instead.

If you want to run the allLayers function when all the layers have loaded, take a look at Rene Rubalcava's blog post "When are layers done?"

1
  • 1
    Thanks I find the issue and a solution(with help). we don't need to loop trough the layers. The Editor-Widget itself checks the editable layers and add them to the widget , and Sorry for the inconvenience caused Jul 15, 2021 at 9:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.