AnsweredAssumed Answered

Why are my graphics not displayed after layer.show()?

Question asked by kawsalee on May 9, 2015
Latest reply on May 18, 2015 by sarahclark

Hi,

 

I'm finding this weird.

I have a couple of feature services which I initialise as hidden, then I add them to the map.

var layer = new FeatureLayer(url, {
     mode: FeatureLayer.MODE_SELECTION,
     outFields: ["*"],
     visible: false
});

 

After adding them to the map, I do a query.

 

When a click event is handled, I'd like to set these layers visible, so I do layer.show();

Before the layer.show(), there are 2 graphics in this layer. But after the layer.show() the graphics are gone.

This is my console log for testing purposes:

Before layer.show(), layer: Object {url: "REMOVED ON PURPOSE", _url: Object, spatialReference: Object, initialExtent: Object, _div: Object…}
Before layer.show(), Graphics: [Object, Object]
Before layer.show(), is layer visible: false
layer.show()
Before layer.show(), layer: Object {url: "REMOVED ON PURPOSE", _url: Object, spatialReference: Object, initialExtent: Object, _div: Object…}
After layer.show(), Graphics: []
After layer.show(), is layer visible: true
-------------------------------------------------------------

What is happening here??

Outcomes