Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

bounds is undefined #18

Open
troykaser opened this issue Sep 10, 2011 · 1 comment
Open

bounds is undefined #18

troykaser opened this issue Sep 10, 2011 · 1 comment

Comments

@troykaser
Copy link

Hi --

jMapping is working really well for me with one exception. I have a case where very quickly after page load I have to refresh the data and the map. I find that if update is called too quickly after the initial call to render the map, I receive the error: "bounds is undefined" in markermanager.js, Line 764.

This can easily be reproduced with:

$(function(){

$('#map').jMapping();
// do stuff
$('#map').jMapping('update');

});

...though obviously my situation is more complex than this.

I also tried waiting for the afterMapping event to fire but I have the same problem:

$(function(){

$(document).bind('afterMapping.jMapping', function(event, api) {
// do stuff
api.update();
});

$('#map').jMapping();

});

Can anyone provide a suggestion for how I can ensure the map is ready enough for an update so that I can prevent this error?

If you're curious as to why I have this situation: I'm using the BBQ plugin to provide back-button support for AJAX calls that the user has caused on the page. The plugin uses hash tags on the URL to store state and then allows you to re-fire the AJAX call(s) that caused that state. In my case when the page renders with hashtags, the hashtag event fires, I do an AJAX call that refreshes the data that drives the map which means I'm calling jMapping('update') very quickly.

Thanks in advance.

Troy

@mysterycommand
Copy link

I had a very similar issue ( #15 ) … in my case binding to the afterMapping event "worked" (i.e. didn't through the bounds undefined error) but as it turned out, whatever manages the markers on Googles side doesn't always keep in sync with what is displayed.

What I mean is, even if you get access to the api from within the afterMapping event without error, the api might tell you that it has updated (the marker count will be what it should), while visually it has clearly not updated (there are more visible markers than the marker count indicates).

Clear as mud I know, but basically I think it's an issue with the Google Maps JavaScript API V2, and not an issue with jMapping itself … maybe the jMapping folks will update the code to use Google Maps JavaScript API V3 and that will fix it? I'm not holding my breath. In the end I just didn't fix it, as it's not a huge priority for the project I was working on.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants