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;
 }
 }
 })
 })
});
asked Jul 13, 2021 at 22:27

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?"

PolyGeo
65.5k29 gold badges115 silver badges350 bronze badges
answered Jul 14, 2021 at 12:23
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 Commented Jul 15, 2021 at 9:11

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.