Hi i want to delete markers individual markers from my graphics layer on button click
Solved! Go to Solution.
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.
Rajni,
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
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);
});
});
Assign each graphic a unique id attribute when it is placed.
Ok if i assign unique id to each marker, how to use .remove function on trash btn of each marker popup.
Loop through the graphics and check each graphics attribute for the one you are looking for and call markerGL.remove(graphic);
How do i know , i am looking for that graphics as i just clicked on it and try t delete it.
how to find that marker which is clicked
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.
The same problem arise here that i have to click outside of editablepolygon first then only my marker is clickable??
This is behavior as designed.