How to remove graphics from map by usign its attribute

950
2
Jump to solution
10-11-2013 06:49 AM
vinayb
by
New Contributor III
HI all,

  I have us map , using query task i have  selected few states ex texas  and sets some symbols which makes it highlighted so some states have some color and other follow normal color.If i want to remove graphics for texas  what is the best way to do .  I have added feature layer with MODE_SNAPSHOT.
0 Kudos
1 Solution

Accepted Solutions
JonathanUihlein
Esri Regular Contributor
This is how I remove graphics from a map, via a loop, based on a certain attribute:

map.graphics.graphics.forEach(function(g){  if(g.attributes){   if(g.attributes.foo == "foo" || g.attributes.bar == "bar"){    map.graphics.remove(g);   }  } });

View solution in original post

0 Kudos
2 Replies
JonathanUihlein
Esri Regular Contributor
This is how I remove graphics from a map, via a loop, based on a certain attribute:

map.graphics.graphics.forEach(function(g){  if(g.attributes){   if(g.attributes.foo == "foo" || g.attributes.bar == "bar"){    map.graphics.remove(g);   }  } });
0 Kudos
vinayb
by
New Contributor III
Super thanks a lot
0 Kudos