AnsweredAssumed Answered

How to display a Graphics Layer when adding to the Map?

Question asked by rhughes522 on Jul 11, 2018
Latest reply on Jul 11, 2018 by rscheitlin


In my application, using jsapi 3.25, I've built a feature layer from a feature collection, so it does not support querying.  Instead I am looping through the graphics, and when I find the one with the attribute I am looking for I am adding it to a new Graphics layer. 


When the widget loads, I am generating all of the features in the feature layer.  The I loop through the graphics and find the appropriate graphic.  Then I add it to the Graphics Layer.  Using the map.addLayer(myGraphicsLayer) I am adding it to the map.  **Then nothing shows until I modify the extent of the map and force it to redraw.


The problem is that none of the methods on the layer (ie. refresh, or redraw) force the layer to be visible when it first loads.  If I add the graphics directly into the layer they are visible.  For that reason I tried adding the layer with no graphics then listening for the layer-add-result event before adding the graphics.  That still did not work.


Does anyone know what is causing this and how it should be dealt with?  If a Graphics layer is in the map, why would it not be visible until the map extent is changed?