featureClick won't work in cartoDB

المشرف العام

Administrator
طاقم الإدارة
I can get everything except featurecClick to work.

My JS:

window.onload = function(){ var cartoDbTableName = 'sipri_import_export_map_1950_2014'; var domId = 'map'; var mapStyle = document.getElementsByClassName('map-style'); var lat = 0; var lon = 0; var zoomLvl = 2; var options = { center: [lat,lon], zoom: zoomLvl }; var mapObject = new L.Map(domId,options); var layerSource = { user_name: 'chrismp', type: 'cartodb', sublayers: [ { sql: "SELECT * FROM "+cartoDbTableName+" WHERE (gwsyear 0)", cartocss: mapStyle[0].innerHTML } ] }; L.tileLayer('http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png') .addTo(mapObject); cartodb.createLayer(mapObject,layerSource) .addTo(mapObject) .on('done',function(layer){ layer.getSubLayer(0).on('featureClick', function(e, latlng, pos, data, subLayerIndex) { console.log(e, latlng, pos, data, subLayerInde); }).on('error',function(err){ console.log('featureClick error: '+err); }); }).on('error',function(err){ console.log(err); }); }; The map loads, but I can't actually click any country. What gives?



أكثر...
 
أعلى