Hi,
Can anyone give a pointer for the 4.x API that would allow me to listen for when a feature layer query is done?
My workflow allows a user to query a feature layer and draw a graphics layer based on the result of that query. Eventually the app zooms to the result. As some queries can load hundreds of complex feature, we need to put a sort of "processing" message on the app and remove it once finished. The only semi-reliable way to remove this processing message I've found is to listen for the map to stop zoom/panning to the new features. (The zoom will sometimes happen before all the features have been loaded from the query, as the query and draw are done with a promise (asynchronously)
Is there some watchUtils for a feature layer that I've missed reading over the doc?
thanks
Solved! Go to Solution.
You want to check for the FeatureLayerView updating property to be false.
Here is how you can check for when multiple layers are done loading when the app starts.
https://codepen.io/odoe/pen/vJdVpQ?editors=0011
Promise.all([
view.whenLayerView(fLayer),
view.whenLayerView(fLayer2)
]).then(([layerView1, layerView2]) => {
return Promise.all(
[
whenFalseOnce(layerView1, "updating"),
whenFalseOnce(layerView2, "updating")
]
);
}).then(() => {
console.log("done updating")
});
You want to check for the FeatureLayerView updating property to be false.
Here is how you can check for when multiple layers are done loading when the app starts.
https://codepen.io/odoe/pen/vJdVpQ?editors=0011
Promise.all([
view.whenLayerView(fLayer),
view.whenLayerView(fLayer2)
]).then(([layerView1, layerView2]) => {
return Promise.all(
[
whenFalseOnce(layerView1, "updating"),
whenFalseOnce(layerView2, "updating")
]
);
}).then(() => {
console.log("done updating")
});