Select to view content in your preferred language

Editor Component and layerInfos

92
5
Jump to solution
Friday
NicholasRolstad2
Emerging Contributor

I really hate that Esri is pushing these components SO hard yet have virtually no examples for how to work with them. I've had to just figure them out on my own in most cases but for the Editor I'm struggling. There is only one example I can find for the Editor component and its literally just this:

<arcgis-editor position="top-right"></arcgis-editor>

Real helpful stuff.

 

How do I attach layerInfos to this? I'm pulling my hair out trying to get it to work. No matter what I do it just loads every single layer from my webmap into the editor with no layerInfos.

I'm sure this is pretty straightforward, but I can't get it to work, anyone know how it's supposed to work?

 

 

0 Kudos
1 Solution

Accepted Solutions
JeffreyThompson2
MVP Frequent Contributor

Add an id to the Component in the HTML. Then you can grab it with document.getElementById() and add the layerInfos.

const editor = document.getElementById('editor')
editor.layerInfos = [
   //Your infos
]
GIS Developer
City of Arlington, Texas

View solution in original post

5 Replies
JeffreyThompson2
MVP Frequent Contributor

Add an id to the Component in the HTML. Then you can grab it with document.getElementById() and add the layerInfos.

const editor = document.getElementById('editor')
editor.layerInfos = [
   //Your infos
]
GIS Developer
City of Arlington, Texas
NicholasRolstad2
Emerging Contributor

So, that's what I thought! I must just have something else that's getting in the way for me. Good to have confirmation though, thanks!

0 Kudos
NicholasRolstad2
Emerging Contributor

I guess my real problem is that I cant figure out how to stop every single layer on my webmap from appearing in the editor, even ones with editing disabled. 

0 Kudos
JoseBanuelos
Esri Contributor

Hello @NicholasRolstad2 ,

Appreciate the feedback, we will work on updating more of our editing samples to use map components. In the meantime here is a codepen for grabbing a layer in a webmap, and disabling editing using the Editor.layerInfos.

https://codepen.io/banuelosj/pen/gbawaop

 

Thanks,

Jose

0 Kudos
NicholasRolstad2
Emerging Contributor

Thanks for the reply! I did eventually get it sorted by looping over every single layer and setting a layerInfo for them with editing disabled (except for the layer I wanted enabled). I don't remember that being necessary for non-editable layers in the widget version but maybe I'm just forgetting.

Thanks again!

0 Kudos