Select to view content in your preferred language

Clear query results?

1026
3
Jump to solution
08-07-2013 01:12 PM
JessicaKnight1
Occasional Contributor
I am using this sample: https://developers.arcgis.com/en/javascript/jssamples/query_buffer.html  and I'm doing something similar, where a user clicks the map and a buffer is drawn and points selected in that buffer. If I use map.graphics.clear(), the buffer gets cleared, but the selected points remain until you click the map again, which causes another buffer and selection. Is there a similar function I can call to get rid of the queried points? Or do I need to reload the map? I did some searching but couldn't find a solution. Thanks.
0 Kudos
1 Solution

Accepted Solutions
SteveCole
Honored Contributor
In the example you linked, a graphic representation is added to the map which shows the 1 mile buffer. The code "map.graphics.clear" just removes that graphic and doesn't do anything with respect to any selected features.

If you selected features from a feature layer, simply call <your layer>.clearSelection()

View solution in original post

0 Kudos
3 Replies
TracySchloss
Honored Contributor
Since it sounds like you are using a featureLayer, you should just be able to do a clearSelection on it.
0 Kudos
SteveCole
Honored Contributor
In the example you linked, a graphic representation is added to the map which shows the 1 mile buffer. The code "map.graphics.clear" just removes that graphic and doesn't do anything with respect to any selected features.

If you selected features from a feature layer, simply call <your layer>.clearSelection()
0 Kudos
JessicaKnight1
Occasional Contributor
Thank you. That works perfectly!
0 Kudos