Who has a solution?
Thank you for your help. Really appreciated!
I changed the CodePen according to your suggestions, but unfortunately it doesn't make any difference. I changed the layer from the second ("Vlakken - gereed") to the first ("Vlakken") otherwise the Date value field will not get written. What I don't understand is that the Featurelayer ID is not the long ID number from the ArcGIS online portal, but anyhow. Seems the reference is correct. Still the same problem, the graphic is not updated with a refresh(). Only using the zoom buttons, or pan the map.
Working with the correct layer that is already in the view is one issue we can address simply. Unfortunately, I'm still confused as to what you're trying to do and what is expected behavior. Some additional checks would be to look at the renderer and the definitionExpression property of the layer(s) to make sure they don't conflict with the edits being made. Currently, your code only works with and edits 1 layer. However, your Web Map has 3 Feature Layers and your comment about a FeatureLayer having 2 layers is misleading; a FeatureLayer instance only references 1 layer as indicated by the 'layerId' property. Also, I don't understand how changing the 'Dat_uitv' value will affect either the rendering or defintionExpression, so what is it you expect to happen when you update this value?
Here's a modified version of the codepen, but I still don't understand what the overall goal is for this task:
OK, John. What I want to do. This is a requirement from a customer. They have a map with area's / polygons, that indicate a specific location where a certain task:
- should start ( the area is in a color, Purple, Blue or Olive, each color represents a certain task)
- is finished ( the job in this area is done, the color must be Green).
A task is a work job, that a worker must do, example: cleaning the area.
The customer has, (indeed you are correct, sorry for the misleading information), 3 instances of a Featurelayer on his map:
1. Vloer (Dutch for floor)
2. Vlakken (Dutch for area's)
3. Vlakken - gereed (Ducth for area's completed)
It is the same Featurelayer, and the viewable area's on the layers depend on the filter:
1. Vloer, filter setting: only displays the area with id 5, this is the purple area.
2. Vlakken, filter setting: display the area's where id <> 5, the other 3 area's
3. Vlakken - gereed, filter setting: display the area's where id <> 5 AND Attribute: "Dat_uitv" is not empty.
This is the setting my customer made, and he wanted met to fill the "Dat_uitv" attribute with the current date time stamp, when they click on the specific area. Doing that, the map displays which area's have the job finished by showing the area "Vlakken - gereed" layer, according to the filter. Once the "Dat_uitv" attribute has a valid value, the filter of layer "Vlakken - gereed" is TRUE, and this layer displays the area in the color green. The customer can also view the timestamp when this job is finished. This works.
The customer is under the impression, filling the field would have an immediate action where the "Vlakken - gereed" layer is redrawn, refreshed. That is not the case, and should be triggered by an action. This is the question: how to get this done, without a zoom or pan interaction of the user. A browser refresh, zoom or pan action does update the layer...
Maybe the whole interpretation how to solve this is wrong. If there is a better way, let me know.
Hope it is clear now.
I believe the issue you are seeing is that the attribute value you are editing will have no effect on the defintionExpression or renderer of that feature layer and that is why the layer does not change. The "Vlakken - gereed" layer is the one that that will be affected by the edit and is the one we want to call refresh() on.