如果您在页面上有一个融合表派生图,您可以在信息窗口中添加一个按钮来更新融合表中的值 - 这样您就可以将值从 1 更改为 3。再进一步您可以为单击地图标记本身添加一个侦听器并更改值。
更新值(特别是如果您是表的所有者)很简单(https://developers.google.com/fusiontables/docs/v1/using#updateRow 或 https://developers.google.com/fusiontables/docs/v1/sql-reference#updateRow),并且基本上是使用 HTTP 调用请求的相当标准的 sql 操作形式。
UPDATE <table_id>
SET <column_name> = <value> {, <column_name> = <value> }*
WHERE ROWID = <row_id>
向标记添加侦听器以弹出带有更新按钮的信息窗口也很简单:
https://developers.google.com/maps/documentation/javascript/examples/infowindow-simple
// This example displays a marker at the center of Australia.
// When the user clicks the marker, an info window opens.
function initialize() {
var myLatlng = new google.maps.LatLng(-25.363882,131.044922);
var mapOptions = {
zoom: 4,
center: myLatlng,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
var map = new google.maps.Map(document.getElementById('map-canvas'), mapOptions);
var contentString = '<div id="content">'+
'<div id="siteNotice">'+
'button that call some ajax to fire off a column update' +
'</div>';
var infowindow = new google.maps.InfoWindow({
content: contentString
});
var marker = new google.maps.Marker({
position: myLatlng,
map: map,
title: 'Uluru (Ayers Rock)'
});
google.maps.event.addListener(marker, 'click', function() {
infowindow.open(map,marker);
});
}
google.maps.event.addDomListener(window, 'load', initialize);