Select to view content in your preferred language

Listening for the close event on an esri/dijit/Popup JS api 3.16

4648
2
Jump to solution
05-31-2016 12:11 PM
TamiaRudnicky
New Contributor II

I am using esri/dijit/Popup in my javascript api 3.16 web application to return information about various layers. I have an image service identify task tied to the map click that returns an elevation and displays it in a div in the corner of the map. I would like to be able to hide the elevation div when I close the popup window, however I don't know what to listen for when I click the close button since there is no "id" associated with it. I've looked at the api reference for the popup class and I have tried using the code snippet - connect.connect(popup,"onHide",function(){ console.log('info window is hidden');  });  I've tried using '"on" instead of "connect" but nothing works. I saw someone had posted a similar question and received an answer however that solution works only in the new javascript api 4.0.  Can anyone help me?

Thanks!

1 Solution

Accepted Solutions
thejuskambi
Regular Contributor

It would be really helpful, if you could share some code. If you are using default popup, below code works.

         map.infoWindow.on('hide', function(){
            alert("infoWindow hide event");
          })

If you have created you own popup, then you should use that instance to listen to "hide" event

View solution in original post

2 Replies
thejuskambi
Regular Contributor

It would be really helpful, if you could share some code. If you are using default popup, below code works.

         map.infoWindow.on('hide', function(){
            alert("infoWindow hide event");
          })

If you have created you own popup, then you should use that instance to listen to "hide" event

TamiaRudnicky
New Contributor II

That is it! Thank you so much. I spent far too long trying to figure that out!

0 Kudos