On Jul 21, 11:21 pm, jacksplatt11 <[email protected]> wrote:
> Thanks Terry, I chose to just use a mapInit function and fix up all my
> global variables and such, much nicer now but I'm still having trouble
> with MarkerClusterer. I understand about asynchronous now, and that
> the data isn't there when it's trying to be used, but how do I get
> around that? I read about callback functions and the like, but I'm not
> sure how to adapt that for what I need? I was looking at this 
> sitehttp://w3future.com/html/stories/callbacks.xmland I understand the
> concept but just not how to adapt it for my use?

Move the initialization of the markerclusterer inside the callback
function after you have inserted the returned data in the array (as I
said above):
...
          // put the assembled side_bar_html contents into the
side_bar div
          document.getElementById("side_bar").innerHTML =
side_bar_html;
      markerCluster = new MarkerClusterer(map, gmarkers);
      GLog.write("loaded "+markerCluster.getTotalMarkers()+"
markers");

  -- Larry

>
> On Jul 22, 3:52 am, nolybab <[email protected]> wrote:
>
> > jack,
>
> > honestly, the very best way to load the maps api (at least in my
> > opinion) is to use google's ajax loader, using google.load, and then
> > to call google.setOnLoadCallback.
> > if you'd like more details about that method, let me know and I can
> > give you some good example code...
>
> > however, to keep it simple, you can just call the load in your body
> > tag...for example:
>
> > <body onload="mapInit()" onunload="GUnload()"/>
>
> > in this example, "mapInit()" is a function YOU provide and GUnload()
> > is provided by the google maps api
>
> > hope this helps...
>
> > --noly
>
> > On Jul 21, 1:44 pm, jacksplatt11 <[email protected]> wrote:
>
> > > Thanks guys for your responses, Larry I remember now reading about
> > > asynchronous before so I'll read more into that.
>
> > > Terry, you're absolutely right, I can't believe I didn't notice that,
> > > I haven't done much programming/coding in the last 6 months and before
> > > that I was only a beginner anyway really but that's a rookie mistake.
> > > I'll fix up all that and get all the functions and variables out of
> > > the if loop. Also, when you say calling a function with an onload even
> > > in the body tag, are you referring to where I have seen things like
> > > <body onload="initialize()" onload="gunload()"> as opposed to where I
> > > just have <body onload="gunload()"> and all my map initialization is
> > > in the aforementioned if statement, whereas others have the
> > > initilazition function in the <head> tags. I have seen tutorials of it
> > > both ways, is one way better or more desirable?
>
> > > Thanks for all the help so far
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to