Fire event when FeatureLayer graphic finishes drawing, not just loaded?

1387
3
Jump to solution
06-09-2014 03:55 PM
by Anonymous User
Not applicable
I've seen in the API Reference that FeatureLayer has an event "load", which is "true" when the layer's attributes are ready. Also map has the "layer-add-result" event. However, I have a loading screen covering the map while everything is parsed, and I am trying to take it down once my layer has fully drawn, not just loaded. Unfortunately all of the events I have experimented with reveal the layer before it draws (it has thousands of rows). Is there an event for FeatureLayer like "graphics-finished"? Thanks for any input!
0 Kudos
1 Solution

Accepted Solutions
KenBuja
MVP Esteemed Contributor
The dojo on event gives you some more control over how often it will fire. You can have it fire once, then not fire any more after the map is loaded.

require(["dojo/on"], function(on){      on.once(featurelayer, "update-end", function(){            // will only fire once...        });  });

View solution in original post

0 Kudos
3 Replies
OwenEarley
Occasional Contributor III
I haven't tried using this yet but there is an event called update-end which may be what you are after.

The documentation states that this is 'Fired when the layer has finished updating its content'.

https://developers.arcgis.com/javascript/jsapi/featurelayer.html#event-update-end

Owen
www.spatialxp.com.au
0 Kudos
by Anonymous User
Not applicable
Hey Owen - Thanks for the input. I did try that, and it works, the only issue is that every time I zoom or pan the event fires, so it's constantly sending the request to take down the loading overlay. There's no real harm done except wasting memory, was hoping there is a neater way.
0 Kudos
KenBuja
MVP Esteemed Contributor
The dojo on event gives you some more control over how often it will fire. You can have it fire once, then not fire any more after the map is loaded.

require(["dojo/on"], function(on){      on.once(featurelayer, "update-end", function(){            // will only fire once...        });  });
0 Kudos