Events in infoWindow.

567
1
Jump to solution
05-20-2013 08:07 PM
JimWharton
New Contributor III
I have a link inside of an infoWindow that when clicked, maximizes the window, makes an ajax call and does a setContent on the maximized infoWindow.

I connect the event handler like this:

connect.connect(map.infoWindow, "onShow", function() {     ui.attachDetailsHandler(map); });


My ui module has a method like this:
attachDetailsHandler: function(map) {       var self = this;       query(".details").on("click", function(e) {         Event.stop(e);         var site_id = domAttr.get(this, "id").substring(8);         details.addDetails(site_id, map);       });      }

If I close the infoWindow and open another, the event connects correctly. The problem comes in when I don't close the infoWindow first. If I just click another graphic on the map, it displays an infoWindow, but the event that should be attached to the link isn't connected. Because of this, the link just reloads the page instead of making my ajax call.

Why do I need to hit the "X" before opening another infoWindow?
0 Kudos
1 Solution

Accepted Solutions
JimWharton
New Contributor III
Never mind, I got it. It looks like the infoWindow gets reused if you click on another point. So it never calls an "onHide" method. Therefore, the "onShow" method doesn't get called again. What it does do is fire an "onRestore" method. I can jack into that and get the result I need.

-Jim

View solution in original post

0 Kudos
1 Reply
JimWharton
New Contributor III
Never mind, I got it. It looks like the infoWindow gets reused if you click on another point. So it never calls an "onHide" method. Therefore, the "onShow" method doesn't get called again. What it does do is fire an "onRestore" method. I can jack into that and get the result I need.

-Jim
0 Kudos