Editor Widget and TypeScript - can layerInfo accept GeoJSON layers?

94
3
Jump to solution
a week ago
Highlighted
New Contributor

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)
Reply
0 Kudos
1 Solution

Accepted Solutions
Highlighted
Esri Contributor

Your workaround would be the best suggestion for now. 

View solution in original post

3 Replies
Highlighted
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.

Highlighted
New Contributor

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

Reply
0 Kudos
Highlighted
Esri Contributor

Your workaround would be the best suggestion for now. 

View solution in original post