AnsweredAssumed Answered

Layer not drawing on map and I need to know about it...

Question asked by processing... on May 8, 2017
Latest reply on May 10, 2017 by processing...



I have a JavaScript function that adds a list item to an un-ordered list when a layer is added to the map through the API. This function call is right after the ESRI add to map function call. This usually works. Even if the layer takes a few seconds to render, the HTML list still shows a representation of that layer.


The problem is when the layer cannot be drawn. I've jammed in bad urls for a layer that I'm adding for testing purposes. My layer shows in the HTML list but I'll get an alerted error message after a few seconds that the layer was unable to be drawn.


What I'd like to do is still add to my HTML list, but add some CSS (red strike through) to note that there was a problem with that particular layer. What's my best bet? Should I use a deferred promise on the function that adds the layer to the map so that I have a call back method to change the CSS?


I ask because I feel like I'm over thinking this. The drawing/adding of a layer on the map looks async so my other code continues and is done by the time I get the alert/error from ESRI.