AnsweredAssumed Answered

layers-add-result event not triggered if error encountered loading a layer

Question asked by myESRIUName on Jun 15, 2015
Latest reply on Jun 16, 2015 by myESRIUName

Hello all,


I'm finding that if there is a problem loading any layer included when I addLayers to the map, the "layers-add-result" event doesn't seem to fire. I've found someone else who seems to have had the same problem (Only load layers from map services user has access to) but their solution won't work in my case and the only person who commented said they didn't see this behaviour.


So...I'm including a sample page to illustrate the problem. It's been put together from a couple of the ESRI sample pages and should run as is. The version attached works fine and you should see the question "Has this event been triggered?" in the browser's console when the map has finished loading.


However, if you break the URL of one of the layers being loaded (effectively ensuring an error occurs while trying to load one of the layers), the question doesn't appear.


I don't imagine this is the way it is supposed to work but even if it isn't, I feel certain that someone must have run into this issue before. If this event isn't triggered, what other way is there to know when the map is finished doing whatever it's going to do after the page has been loaded?





2015/06/15 - Later note: I'm marking Owen's answer as correct because the "layers-add-result" event is indeed being triggered as per his response. However, for more information about this situation, I refer you to my response to his.