Search code examples
javascriptgoogle-maps-api-3google-fusion-tables

Problem with event listener in google maps (with fusion tables)


I am trying to use google maps inside a jquery mobile app. The map has a fusion table layer, the layer loads properly, and the click listener gets called, but the value given to the callback function is null. I need to use values associated with the marker clicked.

Setting the layer and adding the event listener.

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(...);
});

Am I using the addListener properly?

Relevant documentation.

Relevant example.


Solution

  • Code works properly. Restarted my computer and the problem appears to have disappeared. (Clearing a cache perhaps?)