3 Replies Latest reply on Oct 21, 2006 8:19 AM by rutfield

    Portlet for Google Map, problem with Refresh

    cedorman65

      I am trying to put a Google Map into a portlet. It is easy enough to have
      an html fragment that pulls in the google map javascript, add a button,
      and when the user clicks on the button, draws the map. It looks like:



      <script LANGUAGE=JavaScript>
      function loadMap() {
      if (GBrowserIsCompatible()) {
      var map = new GMap2(document.getElementById("map"));
      map.setCenter(new GLatLng(0.0, 0.0), 5);
      }
      }




      The problem is that if I include this in a doView fn, then every time that a refresh is done, it replaces the map with a new map. I don't really have
      a handle on the state of the map (zoom, lat/long, overlays, etc.) so I can't
      tell it to redraw it's current state. I would not want to anyway.

      I would think that the same problem would happen with most Ajax / dhtml apps. Since the state of the stuff inside the portlet is stored somewhere else, for example, on the client, the state gets lost when a refresh is done. Is there anyway to tell the portal to not refresh, or how do I write doView so that it leaves it alone after initialization?

      Clark