Hi i want to delete markers individual markers from my graphics layer on button click
Rajni,
That delete button is inside the popup right? The popup is associated with a specific feature (graphic) so you can call view.popup.selectedFeature.attributes.xyz to get the graphics xyz attribute.
Ok if i assign unique id to each marker, how to use .remove function on trash btn of each marker popup.
Assign each graphic a unique id attribute when it is placed.
How to look for that exact marker which i want to delete on which i have clicked and delete button is on its popup.
I loop through marker layer and get all markers object in console, how to get exact current marker which is clicked
jQuery('#main').on('click','.delete',function(){ markerGL.graphics.map(function(gra){ console.log(gra.geometry); }); });
You need to loop (map) through the graphicsLayer.graphics and look for the graphic that has the attribute you which to delete and call remove.
https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-GraphicsLayer.html#remove
Signed in members can post, follow updates, and more. New here? Register a free account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.