Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
techno-list
Partner - Contributor II
Partner - Contributor II

I have used Qlikview extensions. But why infowindow is only pointing at the first marker of google map? How to put in loop so that I get it at all the markers on mouseover?

tooltiprecent.png

Below is the code:

function map_init() {

      Qva.AddExtension("GoogleMaps - Marker",function() {

  var _this = this;

  var divName = _this.Layout.ObjectId.replace("\\", "_");

  var map_canvas = document.getElementById('map_canvas');

  if (_this.Element.children.length == 0) {

  var ui = document.createElement("div");

  ui.setAttribute("id", divName);

  _this.Element.appendChild(ui);

  $("#" + divName).css("height", _this.GetHeight() + "px").css("width", _this.GetWidth() + "px");

  } else {

  $("#" + divName).css("height", _this.GetHeight() + "px").css("width", _this.GetWidth() + "px");

  $("#" + divName).empty();

  };

  var latlngbounds = new google.maps.LatLngBounds();

  var map = new google.maps.Map(document.getElementById(divName,map_canvas), {

  mapTypeId: google.maps.MapTypeId.ROADMAP

  });

var contentString = '<div id="content">'+

  '<div id="siteNotice">'+

   '</div>'+

    '<h1 id="firstHeading" class="firstHeading">image "infowindow"</h1>'+

    '<div id="bodyContent">'+

  '<img src="http://jpeg.org/images/jpeg-home.jpg"        width="200" height="200" />'+

    '</div>'+

   '</div>';

  

  var infowindow = new google.maps.InfoWindow({

  content: contentString

  });

     for (var i=0,k=_this.Data.Rows.length;i<k;i++){

  var row = _this.Data.Rows ;

  var latLng = new google.maps.LatLng(row[0].text,row[1].text);

  var marker = new google.maps.Marker({position: latLng, title: row[2].text, map: map});

  latlngbounds.extend(latLng);

  google.maps.event.addListener(marker, 'click', (function(value) { return function() { _this.Data.SelectRow(value) }})(i))

  google.maps.event.addListener(marker, 'mouseover',function(){

infowindow.open(map,marker);

  });

  };

  map.setCenter(latlngbounds.getCenter());

  map.fitBounds(latlngbounds);

  });

};

/* load external libs - callback map_init() */

loadLibs();

function loadLibs() {

  Qva.LoadScript('https://maps.google.com/maps/api/js?sensor=false&callback=map_init')

};

0 Replies