Select to view content in your preferred language

Editor widget for offline layer, added feature disappears when drawing completes but shows after save clicked

1006
3
Jump to solution
12-13-2022 03:27 AM
AmroOsama
Emerging Contributor

Hello,

 

I'm using Arcgis JS api 4.23  with angular using the arcgis/core package

 

I have an offline featurelayer, with no url, and the source is set to an empty array

when using the editor widget, I start drawing the graphic, the lines show fine, as soon as I double click to finish drawing, the shape (line or polygon)  symbology disappears,

and only the vertices are still shown.

When saving and ending the add operation, the feature is displayed again properly.

what I already tried:

Added a renderer for layer.

Setting the drawing symbol of the editor widget's through supportingWidgetDefaults.sketch.polylineSymbol

Hide all layers, thinking it may go beneith any layer.

Following are screenshots of the different drawing phases,
second one shows the disappearance of the shape.

While drawing:

AmroOsama_1-1670929961782.png

 

After completing the draw (double click)

AmroOsama_2-1670929985589.png

After saving:

AmroOsama_3-1670930041719.png

 

0 Kudos
1 Solution

Accepted Solutions
AmroOsama
Emerging Contributor

Ok, I found the solution, turned out to be a silly problem I'm responsible off. 

The problem is that I was clearing map.layers before adding layers again,

And it seems that the Editor widget adds a graphics layer to the map layers collection, thus the shape would disappear.

Not sure it was working when the drawing phase is still active, or when editing. 

So I made sure that I remove all layers except graphic layers.

 

Have a nice day!

View solution in original post

0 Kudos
3 Replies
UndralBatsukh
Esri Regular Contributor

Hi there, 

So I tested client-side feature layer with polylines with Editor widget and I was not able to reproduce the behavior you described. Here is a simple codepen app I set up: https://codepen.io/U_B_U/pen/ExRBWpL?editors=1000

 

0 Kudos
AmroOsama
Emerging Contributor

Thank you, 
I tried it, it was the same

0 Kudos
AmroOsama
Emerging Contributor

Ok, I found the solution, turned out to be a silly problem I'm responsible off. 

The problem is that I was clearing map.layers before adding layers again,

And it seems that the Editor widget adds a graphics layer to the map layers collection, thus the shape would disappear.

Not sure it was working when the drawing phase is still active, or when editing. 

So I made sure that I remove all layers except graphic layers.

 

Have a nice day!

0 Kudos