Hi all,
I have one issue on my map, when i add feature layer on map after generated it from expression i goTo result, it works fine, but when i want to zoom in or zoom out or move side, extent updates automatically and returns me back to first generated extent. when i remove TARGET and ZOOM code does not work.
how can i stop continuously updating my extent?
Thanks.
here is code snippet i use to goTo() layer:
view.whenLayerView(xaro).then(function(layerView) {
layerView.watch("updating", function(value) {
if (!value) {
layerView
.queryFeatures()
.then(function(results) {
// do something with the resulting graphics
graphics = results.features;
view.goTo({target: graphics, zoom: 15})
});
}
});
});
You can do this a couple of ways. Most convenient is to use whenFalseOnce()
The other is to ruse the WatchHandle remove method when done
https://developers.arcgis.com/javascript/latest/api-reference/esri-core-Accessor.html#WatchHandle
const handle = layerView.watch("updating", (value) => {
// do your thing
handle.remove()
})
Thank you Rene, works like a charm 🙂