Disable Popup when Adding Geometry on Graphic Layer 3.x

2895
7
Jump to solution
07-24-2017 11:36 AM
YukiHuang
New Contributor II

I try to use map.setInfoWindowOnClick disable pop up window when drawing features, but it does not work. Sample like this one: ArcGIS API for JavaScript Sandbox, I open dev tool and use map.setInfoWindowOnClick(false), but the popup still can be show. Is there a way to disable the popup?

Thanks,

Yuki

0 Kudos
1 Solution

Accepted Solutions
RobertScheitlin__GISP
MVP Emeritus

Yuki,

   For clusterlayer specifically you need to use:

clusterLayer.disableMouseEvents();

otherwise

map.setInfoWindowOnClick(false);

works fine.

View solution in original post

7 Replies
EvelynHernandez
Occasional Contributor III

Add this to ur code, if that helps u, please mark this answer as a correct

clusterLayer.on('click',function(e){
 map.infoWindow.hide();
 });
YukiHuang
New Contributor II

Yes, your solution is somehow correct, but the problem is that this would block the pop-up forever, should be a way like .off(event). BTW, the feature is still clickable, I really want to click action does not even click the feature.  Anyway, thanks a lot. 

0 Kudos
EvelynHernandez
Occasional Contributor III

Then , I didnt understand what u wanna do >.<

0 Kudos
YukiHuang
New Contributor II

Actually, I want to use Draw Tool to create features on the map, but it turns out that if I cross any feature layers or other layers on the map, related popups will show which is really annoying. So I want to disable the popups during the drawing.

I found a solution is that use pop-up manager:

1. arcgisUtils.createMap(webMapId, "map", {mapOptions: mapOptions, usePopupManager: true}

2. map.setInfoWindowOnClick(false) 

It works out when the map is created via web map id.

The remaining problem is that I need to implement the map that created by new Map(). 

P.S. The problem that I want to deal with is a little bit tricky  ~_~

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Yuki,

   When you add map.setInfoWindowOnClick(false); to line 74 of this sample it works fine:

https://developers.arcgis.com/javascript/3/sandbox/sandbox.html?sample=popup_chart 

Do you specifically need it to work with the cluster layer sample? If that is the case then you need to use clusterLayer.disableMouseEvents(); and then re-enable them when done drawing.

0 Kudos
YukiHuang
New Contributor II

Robert, 

Thank you for your reply. Right now, only cluster layer, but I need to handle layers like feature layers, graphic layers, and KMLs. I have tried some examples provided in documents. Besides the feature collection example, ArcGIS API for JavaScript Sandbox , which would show a light blue box of the feature, all others work perfectly. 

I think it might be due to some quirk behaviors in my app...

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Yuki,

   For clusterlayer specifically you need to use:

clusterLayer.disableMouseEvents();

otherwise

map.setInfoWindowOnClick(false);

works fine.