Editor Widget and TypeScript - can layerInfo accept GeoJSON layers?

329
4
Jump to solution
11-18-2020 12:37 PM
yuruiology
New Contributor II

Hi - we are trying to use the Editor widget (JS API 4.17) in our web app however it seems it automatically enables editing for all editable FeatureLayers and GeoJSON Layers. We want to disable add/edit for all the GeoJSON Layers - according to the documentation we could do that by providing `layerInfos` with the right flags - however, `layerInfos.layer` seems to only allow `FeatureLayer` (in TS typings and as described in the documentation) but not other types.

Force casting GeoJSONLayer type to "FeatureLayer" seems to work but it definitely isn't ideal - I'm wondering if this is an issue with the documentation & TS typings, or if there is a better way to do this?

Thanks!

Tags (3)
1 Solution

Accepted Solutions
HeatherGonzago
Esri Contributor

Your workaround would be the best suggestion for now. 

View solution in original post

4 Replies
HeatherGonzago
Esri Contributor

The doc is correct it is currently only implemented for FeatureLayer types. I have added this to our list of enhancements for the Editor. Thanks for the feedback.

yuruiology
New Contributor II

Thanks - the code seems to work if we force a GeoJSON layer into `layerInfo` - is there a better workaround? 

HeatherGonzago
Esri Contributor

Your workaround would be the best suggestion for now. 

View solution in original post

Esri_PrajaktaPatil
New Contributor

Hello Heather,

I am new to the community. I am working on the geoJSON layer. I have added an editor to edit and add features to this layer. after edit, I need to save these edits or newly added features to GeoJson  so I added one button and on click event, I am trying to send it to an external API to update my existing GEOJSON. But I am not able to access my geojson layer on button click event.Please help me with this.I appriciate your responce.

Thank you!

Reply
0 Kudos