Editor widget doesnt work with GeoJSONLayer in 4.22, does in 4.21

672
3
Jump to solution
02-14-2022 06:40 PM
ZachPorteous
New Contributor III

Hello,

I'm not able to get the Editor widget to work with a GeoJSONLayer in the 4.22 version, but in the 4.21 version with the same code, it works. I don't believe the configuration has changed at all, which is why I'm confused. The first screenshot is Editor widget working correctly in 4.21, the second is the same code in 4.22. Im swapping out the versions in the script tag. 

ZachPorteous_0-1644892486307.png

ZachPorteous_1-1644892596134.png

Im also getting a typescript error when building with ES modules in the same situation: 

ZachPorteous_2-1644892682802.png

Is someone able to check if this is happening to them?

0 Kudos
1 Solution

Accepted Solutions
UndralBatsukh
Esri Regular Contributor

Hi there, 

At 4.22, we added GeoJSONLayer.editingEnabled property on GeoJSONLayer and by default it is set to false.  GeoJSONLayer did not editingEnabled property in previous versions of 4.21 and editing was allowed without this check. Please set the editingEnabled to true in your GeoJSONLayer constructor and it should solve the problem you are running into.

View solution in original post

0 Kudos
3 Replies
UndralBatsukh
Esri Regular Contributor

Hi there, 

At 4.22, we added GeoJSONLayer.editingEnabled property on GeoJSONLayer and by default it is set to false.  GeoJSONLayer did not editingEnabled property in previous versions of 4.21 and editing was allowed without this check. Please set the editingEnabled to true in your GeoJSONLayer constructor and it should solve the problem you are running into.

0 Kudos
ZachPorteous
New Contributor III

ahh thank you so much Undral, totally missed that in the documentation! 

do you have any idea why Typescript is complaining about layer not being of type Feature Layer? Is this expected behavior @UndralBatsukh ?

ZachPorteous_1-1644945451043.png

 

ZachPorteous_0-1644945399359.png

 

0 Kudos
ZachPorteous
New Contributor III

ah I found https://community.esri.com/t5/arcgis-api-for-javascript-questions/editor-widget-and-typescript-can-l...

which explains that teh docs say that in typescript this is not possible and you must cast geoJSON layer to Featur Layer, ive done that and it works but field configs object does not work. thanks,

0 Kudos