Igor
Posts: 0
Joined: Tue Apr 02, 2013 12:05 pm

Infowindow

Hello,

Please try to debug your App: http://docs.appery.io/documentation/d...
Is there any errors in browser console?

Blair Cox
Posts: 0
Joined: Thu Jun 04, 2015 2:29 pm

Infowindow

Hi Maryna,

Seems pretty straightforward to add the click event to the listener... but I'm obviously missing something.

[quote:]
var list_location = localStorage.getItem('farmProducts_storage');
var obj = JSON.parse(list_location);
var coordsArray = obj;
marker = [];
markers = [];
var image = 'http://www.buylocalnb.ca/markers/farm...';
map = new Appery("Gmap").options.mapElement.gmap('get', 'map');

var CreateMarker = function(coordsArray, i){

Code: Select all

 var marker = new google.maps.Marker({  
     position: new google.maps.LatLng( coordsArray[i].lat, coordsArray[i].lng ),  
     title: coordsArray[i].business_name,  
     map: Appery("Gmap").gmap,  
     icon: image, 

 }); 

// Adds a marker to the map and push to the array.
markers.push(marker);

Code: Select all

 var infowindow = new google.maps.InfoWindow({content: ('[b]' + coordsArray[i].business_name + '[/b]

' + coordsArray.hours_season + '
' + coordsArray.combinedAddress )});

Code: Select all

 $(document).off("click", "#content").on("click", "#content", function(){ 
 Appery.navigateTo("farm_products_details"); 

});

Code: Select all

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

};
for (var i = 0, j = coordsArray.length; i < j; i++)
CreateMarker(coordsArray, i);

google.maps.event.addListener(map, 'bounds_changed', function() {

});

[/quote]

Blair Cox
Posts: 0
Joined: Thu Jun 04, 2015 2:29 pm

Infowindow

Hi Igor,

I've followed along with this as well. I'm not seeing any errors or notifications in the console. Clicking the infowindow has no action. Thoughts? I tried this outside the loop as well, but perhaps not properly.

[quote:]
var list_location = localStorage.getItem('farmProducts_storage');
var obj = JSON.parse(list_location);
var coordsArray = obj;
marker = [];
markers = [];
var image = 'http://www.buylocalnb.ca/markers/farm...';
map = new Appery("Gmap").options.mapElement.gmap('get', 'map');

var CreateMarker = function(coordsArray, i){

Code: Select all

 var marker = new google.maps.Marker({  
     position: new google.maps.LatLng( coordsArray[i].lat, coordsArray[i].lng ),  
     title: coordsArray[i].business_name,  
     map: Appery("Gmap").gmap,  
     icon: image, 

 }); 

// Adds a marker to the map and push to the array.
markers.push(marker);

Code: Select all

 var infowindow = new google.maps.InfoWindow({content: ('[b]' + coordsArray[i].business_name + '[/b]

' + coordsArray.hours_season + '
' + coordsArray.combinedAddress )});

Code: Select all

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

  $(document).off("click", "#content").on("click", "#content", function(){ 
 Appery.navigateTo("farm_products_details"); 

      setTimeout(initialize, 1000);  

});
};
for (var i = 0, j = coordsArray.length; i < j; i++)
CreateMarker(coordsArray, i);

google.maps.event.addListener(map, 'bounds_changed', function() {

});

[/quote]

Serhii Kulibaba
Posts: 150
Joined: Tue Aug 27, 2013 1:47 pm

Infowindow

Hello,

Please use simple google example: https://developers.google.com/maps/do...
Just change predocument&#46;getElementById('map')/pre to preApperyio("googlemap_name")&#46;gmap/pre here googlemap_name- name of the map component

Blair Cox
Posts: 0
Joined: Thu Jun 04, 2015 2:29 pm

Infowindow

map = new Appery("Gmap").options.mapElement.gmap('get', 'map');

Hmm, don't I already have it though??

Blair Cox
Posts: 0
Joined: Thu Jun 04, 2015 2:29 pm

Infowindow

Sergiy, I see that perhaps the question was misunderstood. My infowindow appears just fine. However I want to create a click event within the opened infowindow box.

Serhii Kulibaba
Posts: 150
Joined: Tue Aug 27, 2013 1:47 pm

Infowindow

Have you check google's example? What event do you use for running this JS?

Return to “Issues”