I have a popup that works perfectly fine. Whenever I switch layers though, the popup still hangs around along with its outline. How does one close it, say by clicking a button? I tried adding the function "map.infoWindow.hide();" to my code but that doesn't seem to be working. I set my infowindow in the map to popup. Any help would be greatly appreciated!
Solved! Go to Solution.
NM Water,
The maps infowindow by default is a popup dijit so you can use:
map.infoWindow.clearFeatures();
NM Water,
The maps infowindow by default is a popup dijit so you can use:
map.infoWindow.clearFeatures();
Hi Robert!
Thanks for your reply! Unfortunately, this isn't working: I get the following error.
" Uncaught TypeError: Cannot read property 'clearFeatures' of undefined"
I believe this might be an error of how my code is being placed? Have you ever experienced this before?
Thanks for all your help!
Francisco O
Francisco,
Can you verify that you have access to map.infoWindow by using console.info(map.infoWindow);
Hi Robert,
Thanks for your response. I do indeed have access to the console.info: it gives the following result.
Here are some snipps of my code.
I think it might be an issue of how I'm placing my code.
Do you have a link or jsbin you can share that shows your issue?
FYI, in the 4.0 API you will be able to do view.popup.close() to accomplish this.
I don't have a link working yet. But I attached some snipps in the previous reply.
Thanks for all your help!!
NM Water,
Did you put the console statement in the closepopup function, to ensure you have access to the map.infoWindow inside that function
Hi Robert,
After some more careful look at my code, I got it to work. However, would there be a way to completely close the popup?
This is what I get with map.infoWindow.clearFeatures();
Before:
After:
Thanks for all your help Robert!!
Francisco
Francisco,
Sure use map.infoWidow.hide();