Yan
Yan

Reputation: 21

FusionTablesLayer infoWindow re-style did not show up in web page

In my web page I am using the FusionTablesLayer with data and infoWindow style coming from a FusionTable View. They have worked nicely. However, I did a re-style to change the size of the image display, and the font sizes, font colors. I could see the changes from the Fusion Table Map, I could also see the tableId and the encripted tableId did not get changed thereafter, and the infomration is saved, but I could not see the changes from my web page. Am I missing anything here? Any suggestion??

Upvotes: 1

Views: 825

Answers (1)

Yan
Yan

Reputation: 21

I resolved the issue by not using the infoWindow that comes with the FusionTablesLayer by doing the following:

1.suppressinfoWindows:true

  1. create my own infoWindow
  2. create openInfoWindow click event handler for the FusionTablesLayer here it is layer2

create openInfoWindow click event handler for the FusionTablesLayer here it is layer2

Like this:

var map;
var infoWindow = new google.maps.InfoWindow();
function openInfoWindow(FTevent) {
    var contentStr = "<div class='googft-info-window' style='font-family:Arial, Helvetica, sans-serif; font-size: 12px; margin: 0; padding:0; background-color: #ffffff;'>";
   contentStr += "<h5 style='margin-top: 0; margin-bottom: 15px; color: #009AA6;'>" + FTevent.row['NAME'].value + "</h5>";
   contentStr += "<div style='text-align: center; width: 300px; height: 220px;'>";
   contentStr += "<img src=" + FTevent.row['URLIMAGE'].value +  " style='vertical-align: top; max-width: 300px; max-height: 220px;'><br>";
   contentStr += "</div></div>";
   infoWindow.setOptions({
   content: contentStr,
   position: FTevent.latLng,
   pixelOffset: FTevent.pixelOffset
});
infoWindow.open(map);
}
function initialize() {
.....
google.maps.event.addListener(layer2, 'click', openInfoWindow);

}

By doing so, I can also listen to the infoWindow for the 'closeclick', and so something when the infoWindow is closed, like this:

  map.setZoom(7);
  map.panTo(centerMarker.getPosition());
});

Upvotes: 1

Related Questions