Hi,
I have noticed a rather odd behavior within Experience Builder - though this might be related to the actual JavaScript API.
I created a custom widget - this is all fine works as expected. With the widget I programmatically create several Feature Layers, add it to the map, enabling users to add and remove features from this layer - this also works as expected. When I add the layer from the code the legend and layer widget automatically get updated as expected - so that also works.
Everything is fine - but when we try to print the odd behavior was encountered. If the user adds to polygon shapes to the feature layer with the custom-made tool- it works fine. Then if the user pans/zooms away and prints out the map using a print widget and the associated print service - again it is fine, printing how it should.
However - if the user adds/deletes a feature and clicks the print button again without any panning and zooming - the print tool does not print out the these changes untill panning/zooming occurs. My code logic uses the standard way of operating on feature layer using the applyEdit() function.
For instance - the delete function from the widget as follows:
removeCircuitArea = (evt) =>
if (this.mapView.view.map.layers.filter(c => c.title === 'Scraper Circuit Area').length !== 0)
this.scraperCircuitAreaLayer.queryFeatures( geometry: evt.mapPoint, spatialRelationship: "intersects", returnGeometry: true, outFields: ["*"] ).then((featureset) =>
let delfeatures: any[] = [];
featureset.features.forEach(f => delfeatures.push(f));
const deleteEdits = deleteFeatures: delfeatures
this.scraperCircuitAreaLayer.applyEdits(deleteEdits);
)
As far as I can see my code follows up recommended routines.
But somehow it seems like something is not being refreshed - so the print widget does not pick up the changes.
Can anyone tell me what are those object(s) that needs to be looked at and refreshed/reloaded/revisited?
PS calling the featureLayer.refresh() method does not make any changes in this case. Also - using the Edit widget on a real feature layer does not have this issue - removing a feature using Edit tool immediately gets reflected in a printout without any additional panning/zooming.
Thanks