infoWindow onHide event

3714
1
03-20-2012 03:35 PM
SebastianRoberts
Occasional Contributor III
I am using the attribute inspector with a feature layer on my map.  I need to know when a user closes the infoWindow by clicking the x or close button.  The map.infoWindow "onhide" event fires every time the user clicks on the map, so this will not do.  Does anyone know how how to create an event listener for the onClick event of the close button on the infWindow dijit?  The button doesn't have an id attribute that I can refer to, and i haven't been able to find anything in the Dojo dijit documentation to help me.
0 Kudos
1 Reply
SebastianRoberts
Occasional Contributor III
I just found that you can use the dojo attachpoint for the button. 


This is the html of the close button in the infowindow:
[HTML]<a class="hide" dojoattachpoint="_hide" dojoattachevent="onclick:hide" style="margin-left: 303px; "><div class="sprite"></div></a>[/HTML]

Here is how you can listen for the click event of the close button.

dojo.connect(map.infoWindow._hide, "onclick", function(){
      //your code here for handling the close button click.
});