Lately the popup is getting stuck. I'll click a feature and get a result. If I click anywhere else on the map, even on a different layer, I'll get the same result from the first click. If I toggle the layer on and off. this usually goes away. I also have the info template set to only show visible layers. When I first click a feature, it shows me results from every layer. Again, if I toggle layers on and off, this problem goes away.
Is anyone else having similar issues?
Solved! Go to Solution.
The issue is that even though the additional layers (First Day High Temp Below 32(F), etc) are not visible since their group layers are turned off, the layers are still marked as visible. If you put a breakpoint in the script to see the value of visArr on the first click, you'll get the result [0,1,2,4,5,6,8,9]. Note that layers 3 and 7 (the group layers) are not included. This is how the service is set up.
Adding this (line 2) in solved that problem
var analysisLayer = new ArcGISDynamicMapServiceLayer(analysisURL); analysisLayer.setVisibleLayers([0, 1, 2]);
Lloyd,
I have not seen that issue. Check if you are getting an error in your browsers web console. Sounds like you are having an issue setting the popups content before you show the popup and the old content is left in it.
Here are the errors from the console:
init.js:448 dojo/parser::parse() error Error: Tried to register widget with id==dijit_layout_BorderContainer_0 but that id is already registered(…)(anonymous function) @ init.js:448
init.js:426 Uncaught Error: No region setting for layerList
Lloyd,
So if you correct that error then your popup issue will likely go away. I can not help dirrect you to the errors origin with seeing your code though.
I tried to add a region setting to layerList, but it forced the TOC over to the side into a separate pane.
Lloyd,
Try this (line 2):
function executeIdentifyTask(event) {
map.infoWindow.clearFeatures();
identifyParams.geometry = event.mapPoint;
I fixed the order of the function arguments, but "map.infoWindow.clearFeatures();" didn't fix the bug. The first time I click on the map the popup shows all the layers, even with only one layer visible. When I toggle the layer on and off the popup only shows the visible layer.
The issue is that even though the additional layers (First Day High Temp Below 32(F), etc) are not visible since their group layers are turned off, the layers are still marked as visible. If you put a breakpoint in the script to see the value of visArr on the first click, you'll get the result [0,1,2,4,5,6,8,9]. Note that layers 3 and 7 (the group layers) are not included. This is how the service is set up.
Adding this (line 2) in solved that problem
var analysisLayer = new ArcGISDynamicMapServiceLayer(analysisURL); analysisLayer.setVisibleLayers([0, 1, 2]);
OK, thanks. That does help with the popup issue. But it also turns on all the visible layers on when the map loads. I have the service set up to only have the topmost layer or group toggled on at first.