dynamically updating infoWindow content

3,199 views
Skip to first unread message

whiteatom

unread,
Mar 1, 2011, 5:45:24 PM3/1/11
to google-map...@googlegroups.com
Hello all,
I have a map with about 30 markers on it that are representing GPS transponders. The markers are stored in an array, and I have an ajax script that polls the server to get new data and I update the marker positions via the array and all is well. The issue comes with the infoWindows.

I am using some jquery tabs on the windows, and the easiest way was to draw the content of each window in the source and them pass the dom object to the setContent function with jquery when i attach the listener shown here :

google.maps.event.addListener(transponders[i].marker, 'click', function () {
this.infoWindow.setContent(transponders[i].infoWindowDiv);
this.infoWindow.open(map, transponders[i].marker);
});

Note: I'm storing the dom objects in the array as well for testing. Also, I'm using a single shared infoWindow stored in this.infoWindow

I update the div in the source, or in the array, and it doesn't update the infowindow - in-fact it seems the listener is taking the dom object and putting it somewhere, because it's not accessible after the window is first opened. I have read in some other posts that you have to detach the listener and create a new one.. I'm concerned that these dom objects are sitting somewhere.. and after a week of running, this things is going to be chewing up a lot of RAM.

Is there a way of accessing the DOM object that the listener seems to have taken from me so I can redraw it?

Cheers,
ALEC 

Chris Broadfoot

unread,
Mar 2, 2011, 1:12:37 AM3/2/11
to google-map...@googlegroups.com, whiteatom
getContent() will return to you what you passed it in setContent().

Does that help? If you'd like some help with your problem of the InfoWindow not updating please post a link to your map.

Chris

--
You received this message because you are subscribed to the Google Groups "Google Maps JavaScript API v3" group.
To post to this group, send email to google-map...@googlegroups.com.
To unsubscribe from this group, send email to google-maps-js-a...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-maps-js-api-v3?hl=en.



--
http://twitter.com/broady
Reply all
Reply to author
Forward
0 new messages