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?
Solved! Go to Solution.
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
]
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
]
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!
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.
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
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!