I am showing some markers using latitude and longitude, but there is a navigation drawer view, where I can click on the location.
So if I click on any particular location from the drawer, how can I trigger the click event on the associated marker?
Is there any way I can trigger the location item click from drawer to trigger marker click?
let marker = new Graphic({
geometry: {
longitude: item.longitude,
latitude: item.latitude,
type: 'point',
spatialReference: { wkid: 3857 },
},
symbol: this._Constants.MARKER_FLAT,
popupTemplate: {
title: item.name,
content: function () {
var div = document.createElement('div');
div.innerHTML = `<p>Testing</p>`;
return div;
},
},
});
marker.setAttribute('id', String(item.id));
marker.setAttribute('name', String(item.name));
this.mapView.graphics.add(marker);
this.marker = marker;
This Is how I plot the markers
I have tried this approach, but the emit event is returning false.
if (
// this.mapView.emit('click', { // tried this as well
this.mapView.map.emit('click', {
mapPoint: this.marker,
})
) {
console.log('Triggered');
} else {
console.log('NOT Triggered');
}