On Dec 14, 2:50 pm, tom <[email protected]> wrote:
> Hey guys, I have a problem with trying to use a link to open an info
> window. Map is athttp://sustainablefoodguide.com/trialV5.php. The way
> it should work is, the sidebar is made up of an array of markers
> ordered by distance from the point given, for example an australian
> post code (just type 3000 in the search for anyone who doesn't know
> aus post codes). The ahref links are myclick(i) where i is from 0 to
> 9, so in the array the i-th marker has it's info window opened.
> However, this doesn't work, if you click on a link nothing happens and
> the error console just says 'b is undefined' and shows me the google
> map api. But, if you click on that actual marker to open it's info
> window, then you can use the side bar link fine, like it needs to be
> preloaded or something? I've tried playing around with timeouts and
> trying to call another function from the function to open the info
> window to give it time for the data to load but to no avail, it could
> be something really simple though.
tempMarker.tabBusiness and .tabProduce are undefined.
Since you have your markers in a global array called gmarkers[], why
not simply do
function myclick(i) {
GEvent.trigger(gmarkers[i],"click");
}
That does mean that when you create your sidebar you need to keep
track of the global index, rather than using an index on the sorted
data. That means that instead of doing myclick(7) because it's sorted
as position 7 it should do myclick(3) because it's number 3 in your
global array.
Or: make sure that your closest[] markers have .tabBusiness
and .tabProduce defined. But I think that's making things very
complicated. It's generally far easier to define infoWindows only
once, when the marker is created.
Andrew
--
You received this message because you are subscribed to the Google Groups
"Google Maps API" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-maps-api?hl=en.