【发布时间】:2011-10-18 18:35:15
【问题描述】:
我正在尝试在 jquery 移动应用程序中使用谷歌地图。地图有一个融合表图层,图层加载正常,点击监听器被调用,但给回调函数的值为空。我需要使用与单击的标记关联的值。
设置图层并添加事件监听器。
var layer = new google.maps.FusionTablesLayer({
query: {
select: 'Address',
from: table_id
}
});
// map is an instance of google.maps.Map
layer.setMap(map)
google.maps.event.addListener(layer, 'click', function(e) {
console.log(e);
$.mobile.changePage(...);
});
我是否正确使用了 addListener?
相关example。
【问题讨论】:
-
是的,我是。 console.log(e) 打印 'null' 和任何引用“应该”在 e 中的值的尝试 (e.row['Address'].value) 给出“无法读取 null 的属性 'row'” .
-
代码正常工作。 A 出于其他原因重新启动了我的计算机,并且代码现在可以工作了。
标签: javascript google-maps-api-3 google-fusion-tables