PDA

View Full Version : Google Map loading address string



savelee
20 Sep 2010, 8:00 AM
Hi,
I'm fighting with my Google Map. - I can't get it to work to let the Google Map load an adress string.
My guess is, that I have to wait till the callback of the Google Api before loading the script in my ipadUI (I've build a nestedlist like kitchen sink, and load the scripts via Structure.js).
However, this only works when setting the map to fullscreen.
When binding it to my demos.Page5 variable, it does not work...

Can you help me?
Thanks!



// wrapping in closure to avoid global var
(function() {
var strAddress = "Amsterdam";
var geocoder = new google.maps.Geocoder();
var map;

geocoder.geocode( { 'address': strAddress},
function(results, status) {
if (status == google.maps.GeocoderStatus.OK) {
address = results[0].geometry.location;
map = new Ext.Map({
fullscreen: false,
title: 'Map',
//getLocation: true,
mapOptions: {
zoom: 12,
mapTypeControl: false,
center: address
},
listeners: {
maprender: function(comp, map){
var marker = new google.maps.Marker({
position: address,
title : 'Address:',
map: map
});
}
}
});

} else {
//alert("Geocode was not successful for the following reason: " + status);
}
});

demos.Page5 = map;
})();