1

I am building a Rails 3 application using JQuery mobile and I'm confronting a major issue. In my application, I have many views, and in each view I display a Google Maps map.

Now, the problem is next: when I enter in one of the views for the first time, the map renders well. But, if I enter on another view, the map doesn't appear anymore. Everything looks to be all right (the javascript code is executed, I don't have any errors).

The map reappears if I refresh the current page. Do you have any idea what could I do in order to fix this problem?

Thank you very much!

5
  • 1
    how is your map rendered? Do you use the javascript API? Or do you just place an embedded iframe with the map?
    – ampersand
    May 3, 2011 at 6:04
  • Does the map load each time you transition to the page? May 3, 2011 at 13:04
  • My map is rendered in each view inside a div. I use Google Maps v3.
    – gvoicu
    May 4, 2011 at 0:30
  • The javascript code that initialises the map runs every time (I put some alerts to pop out when each view is loading and it works every time). The problem is that the map is rendered in the view only the first time. If I will go on another view containing the map, the map will not be rendered. If I go back to the link where the map first rendered, the map is there.
    – gvoicu
    May 4, 2011 at 0:35
  • The only solution for now is to use rel="external" or data-ajax="false", but this is not the best solution because it generates other kind of errors (not relevant to this topic).
    – gvoicu
    May 4, 2011 at 0:37

1 Answer 1

0

I highly recommend that you consider using this jQuery plugin to ease the JQM integration with Google Maps:

http://code.google.com/p/jquery-ui-map/

It has resolved a number of issues for me such as map persistence.

2
  • Unfortunately using jquery-ui-map didn't solve my problem. :-(
    – gvoicu
    May 2, 2011 at 19:56
  • I could resolve the problem by adding rel="external" as a tag for the urls linking to views containing maps. I mention that it works nice without needing to use jquery-ui-map. Thank you for help!
    – gvoicu
    May 3, 2011 at 13:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.