Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I have an app that does some buffering, only problem is when I click on the map to put in the point/line/polygon vertices to do the buffer, I get popups at every mouseclick. It doesn't interrupt the buffer process but its super annoying.

At first thought I wanted to try and disable the popups so that they didn't show when "No information available" was the result. But I figure there will be more times than not when a popup will return some results and thus, need to disable/hide the popup so that it doesn't appear at all while the buffer process is running.

I've tried putting map.infoWindow.hide(); within the buffer without success and also saw this post recommending an onClick handler and have been unsuccessful as well. Any tips appreciated.

share|improve this question
add comment

1 Answer

Look at this post for a good example JS API Toggle Pop-Up On & Off. When you add connect to the onclick event to the map or featurelayer etc, you need to save the reference to the clickHandle. Then when a workflow is started where you don't want popups on, you disconnect and then re-connect when finished.

//instead of this -- don't do this
dojo.connect(featureLayer,"onClick",function(evt){
   map.infoWindow.setFeatures([evt.graphic]);
   map.infoWindow.show(evt.mapPoint);
});

//do this -- save the click handle to disconnect or reconnect later
var clickHandlePopup = dojo.connect(featureLayer,"onClick", showPopup(evt));

//clickhandler
function showPopup(evt){
   map.infoWindow.setFeatures([evt.graphic]);
   map.infoWindow.show(evt.mapPoint);
}

//start buffering -- disconnect
if (clickHandlePopup) {
    dojo.disconnect(clickHandlePopup);
    clickHandlePopup = null;
}

//stop buffering -- connect
if (!clickHandlePopup) {
    clickHandlePopup = dojo.connect(featureLayer, "onClick", showPopup(evt));
}

Also, see this post for turning popups on and off when using webmaps Turn Popups On/Off in ArcGIS Online Webmap via Javascript API Web Application

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.