Gilbert Gomez
Posts: 0
Joined: Sat Sep 07, 2013 2:35 am

Load VS Show page

Hi, I was dealing with this googleMap control and I had success interchanging values between pages to set latitude and longitude from each service consulted previously.. But I am experimenting some funny things..

The very first time I tried to run the JavaScript I just followed the normal understanding that says that this event should be executed at the "Load" on page... But nothing happed ...The googleMap object just goes to the middle of ocean.

Then I tried with "Show Page " event ...And it works ...googleMap object goes to the right place.... But it does not show the Marker...

Finally ...I added a button into the Map page with the same JavaScript code used at "show page" event ..and it works perfectly ..googleMap goes to the right place and show the marker.

So my question is ..Why in "Load page" nothing happened and in "Show page" partially works and in a click event everything is ok ...

pre
var myTitle = localStorage.getItem("svcName");
var myContent = localStorage.getItem("svcMsg");
var newLat = localStorage.getItem("latitude");
var newLng = localStorage.getItem("longitude");
var myLatLng = new google.maps.LatLng(newLat, newLng);

var mapOptions = {
zoom: 15,
center: myLatLng,
mapTypeId: google.maps.MapTypeId.SATELLITE
};

var marker = new google.maps.Marker({
position: myLatLng,
title: myTitle
});

var infowindow = new google.maps.InfoWindow({
content: myContent
});

google.maps.event.addListener(marker, 'click', function() {
infowindow.open(Appery("googleMap1").gmap, marker);
});

Appery('lbPlace_name').text(myTitle);
Appery("googleMap1").options.mapElement.gmap('addMarker', marker);
Appery("googleMap1").options.mapElement.gmap(mapOptions);
Appery("googleMap1").options.mapElement.gmap("refresh");
/pre

Is there any way to make the googleMap object shows the Marker instantly load or display the page? .. or have to leave the button to bring it up

Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

Load VS Show page

Hi Gilbert,

On Show page event run the following JavaScript to set a delay:
codewindow.setTimeout(yourFunction, 1000);/code
where yourFunction is your function and 1000 is a delay in milliseconds.

Return to “Issues”