1 Reply Latest reply on Jul 30, 2008 4:13 PM by brian young

    PDMarker and other scripts are incompatible with rich:gmap

    brian young Newbie

      It simply won't work, it seems.

      To use the lib you do this: <a4j:loadScript src="pdmarker.js" />

      The problem is, pdmarker.js relies on having access to things like GMap2 which are not available apparently at the time when loadScript is called.

      This problem is not really unique to PDMarker, I'm having the same issue in some of my own script files. Is there a way to defer loadScript until the point when GMap2 and other types from the maps API will be available?

        • 1. Re: PDMarker and other scripts are incompatible with rich:gm
          brian young Newbie

          For anybody searching the archives for this problem, I have to following solution to offer:

          Since you can't include scripts via loadScript that reference objects from the Google Map API (since it hasn't been loaded at that point) you have to play a trick or two.

          In the oninit of your rich:gmap component, you can make an AJAX request to the server to get your javascript file, and on the callback, eval it. Because, at this point the Map API *has* been loaded so your script should be fine even if it does things like prototyping GMarker or something.