I am adding a feature layer as such in my index.html file.
featureLayer00 = new FeatureLayer("http://webadaptorserviceurl/MapServer/0",{ mode: FeatureLayer.MODE_ONDEMAND, id: "0", outFields: ["*"], infoTemplate:template });I am then then toggle this layer with show/hide in a common.js file as follows:
...
if (visible.indexOf('0') > -1) { featureLayer00.show(); } else { featureLayer00.hide(); } filteronAttribute();...It works fine until I get to filteronAttribute(). In the common.js file my filteronAttribute() loops through the layer and shows/hides each stat layer piont as follows:
...statLayer = featureLayer00.graphics;dojo.forEach(statLayer, function (g) { if (sza.indexOf('all') > -1) { g.show(); } else if (sza.indexOf('100') > -1 && g.attributes.hosp_beds < 100) { g.show();}); ...If the layer is on and I filteronAttribute all works as expected. However, if the layer is off and I turn it on for some reason the statLayer in filteronAttribute is empty even though it was just set to show.
Is there something that has to happen to the featureLayer after it is switched from hide to show before it is available in other functions?
Everything works fine if the layer is visible and I filter however, if the filter is set and the Layer is switched from show to hide the statLayer in filteronAttribute is always empty even though it is called after the show method on the layer. Any ideas?
أكثر...
featureLayer00 = new FeatureLayer("http://webadaptorserviceurl/MapServer/0",{ mode: FeatureLayer.MODE_ONDEMAND, id: "0", outFields: ["*"], infoTemplate:template });I am then then toggle this layer with show/hide in a common.js file as follows:
...
if (visible.indexOf('0') > -1) { featureLayer00.show(); } else { featureLayer00.hide(); } filteronAttribute();...It works fine until I get to filteronAttribute(). In the common.js file my filteronAttribute() loops through the layer and shows/hides each stat layer piont as follows:
...statLayer = featureLayer00.graphics;dojo.forEach(statLayer, function (g) { if (sza.indexOf('all') > -1) { g.show(); } else if (sza.indexOf('100') > -1 && g.attributes.hosp_beds < 100) { g.show();}); ...If the layer is on and I filteronAttribute all works as expected. However, if the layer is off and I turn it on for some reason the statLayer in filteronAttribute is empty even though it was just set to show.
Is there something that has to happen to the featureLayer after it is switched from hide to show before it is available in other functions?
Everything works fine if the layer is visible and I filter however, if the filter is set and the Layer is switched from show to hide the statLayer in filteronAttribute is always empty even though it is called after the show method on the layer. Any ideas?
أكثر...