Unable to toggle webmap popups

3099
2
Jump to solution
08-08-2013 10:48 AM
deleted-user-1T_bOHag6M8d
Occasional Contributor
I have a need to disable webmap popups when a certain Pane in an Accordion Container is open. I've been implementing Kelly's advice here. However, after I reconnect the clickHandleListener and then try to disconnect the clickEventHandle, the popups still appear. I've created a plunker that demonstrates my issue here.

To reconstruct the issue in the plunker, click the "Popups Disabled" pane which successfully disabled popups. Then click the "Popups Enabled" pane which enables popups. Finally, click the "Popups Disabled" pane again and you'll see that popups are still enabled.

Can anyone provide information why dojo.disconnect(response.clickEventHandle) only appears to work once?

Thanks.
0 Kudos
1 Solution

Accepted Solutions
deleted-user-1T_bOHag6M8d
Occasional Contributor
Ok. Looks like I've come up with a solution. Since the response.ClickEventHandle is only valid for the first time the map loads, I need to set a new handler each time I connect the map "onClick" listener.

In my web application, it looks like this.
var popupHandler = response.clickEventHandle;             dojo.connect(dijit.byId("measurePane"), "onShow", function() {              dojo.disconnect(popupHandler);              console.log("Popups should be disabled");          });            dojo.connect(dijit.byId("measurePane"), "onHide", function() {              popupHandler = dojo.connect(map, "onClick", response.clickEventListener);              console.log("Popups should be enabled");          });

View solution in original post

2 Replies
deleted-user-1T_bOHag6M8d
Occasional Contributor
Ok. Looks like I've come up with a solution. Since the response.ClickEventHandle is only valid for the first time the map loads, I need to set a new handler each time I connect the map "onClick" listener.

In my web application, it looks like this.
var popupHandler = response.clickEventHandle;             dojo.connect(dijit.byId("measurePane"), "onShow", function() {              dojo.disconnect(popupHandler);              console.log("Popups should be disabled");          });            dojo.connect(dijit.byId("measurePane"), "onHide", function() {              popupHandler = dojo.connect(map, "onClick", response.clickEventListener);              console.log("Popups should be enabled");          });
ChristinaMosnick
New Contributor II

The original link to the other thread seems to be broken. Here is the updated url: https://community.esri.com/message/61108