Question

I have a custom info window in fusion tables:

<div class='googft-info-window' style='font-family: sans-serif'>
<img src="{image}" width=200 align=right>
<b>ID Number:</b> {pkey}<br>
<b>Condition:</b> {stateofrepair}<br>...

But sometimes there is no {image} available, which results in a broken image icon on most browsers. Is there a way I can leave the <img> tag off, if {image} is blank?

Was it helpful?

Solution

This isn't possible using the Fusion Tables UI.

But you can do this using the Fusion Tables Layer in the Google Maps API. You can set a click listener on the layer using the Google Maps API. You can access the data associated with the clicked feature in the Event object returned from the click. At this point, you can test whether or not the image value actually contains data, and, if so, show the image.

Here's an example:

http://code.google.com/apis/fusiontables/docs/samples/change_infowindow_content.html

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top