Please explain here below what you were doing when the issue happened
I'm trying to add listener to cart layer 'featureClicked'. But in don't fired up when clicking on feature.
Steps to Reproduce
Please break down here below all the needed steps to reproduce the issue
this.client = new carto.Client({ serverUrl: '/api/carto' });
this.map = L.map(containerId, options)
.setView([0, 0], 3);
this._rasterLayers = L.layerGroup();
this._rasterLayers.addTo(this.map);
const source = new carto.source.SQL(sql);
const style = new carto.style.CartoCSS(cartocss);
let layer = new carto.layer.Layer(source, style, {
featureClickColumns: ['the_geom']
});
Context
Please explain here below what you were doing when the issue happened
I'm trying to add listener to cart layer 'featureClicked'. But in don't fired up when clicking on feature.
Steps to Reproduce
Please break down here below all the needed steps to reproduce the issue this.client = new carto.Client({ serverUrl: '/api/carto' }); this.map = L.map(containerId, options) .setView([0, 0], 3); this._rasterLayers = L.layerGroup(); this._rasterLayers.addTo(this.map); const source = new carto.source.SQL(sql); const style = new carto.style.CartoCSS(cartocss); let layer = new carto.layer.Layer(source, style, { featureClickColumns: ['the_geom'] });
this.client.addLayer(layer); this.client.getLeafletLayer() .addTo(this._vectorLayers) layer.on('featureClicked', (evt) => { console.log('featureClicked', evt); });
Current Result
Please describe here below the current result you got
Click on feature - nothing happened. But if I do this this.client.getLeafletLayer() .addTo(this.map) Event will fired.
Expected result
Please describe here below what should be the expected behaviour
That event will fire anyway.
Browser and version
What internet browser (Chrome, Firefox, etc) and version was you using and version Chrome 74.0.3729.131
Additional info
Please add any information of interest here below