Leaving out blank data, in a custom info window, on Google Fusion Tables [closed]

StackOverflow https://stackoverflow.com/questions/8966638

  •  12-11-2019
  •  | 
  •  

문제

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?

도움이 되었습니까?

해결책

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

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top