Select to view content in your preferred language

Clear Search Widget Selection

532
1
09-10-2022 06:59 PM
StefanFreelan
Occasional Contributor

Hi All,

I'm using the Search widget in a webmap (JS 4.24) and I want the results to either not be selected or to automatically get unselected (somehow) soon after the search is completed.

I do want the map pan/zoom (to the chosen search item) and I want the pop-up. I just don't want the feature to be selected and to remain selected.

By default, the only way to un-select the chosen feature appears to be returning to the Search widget to clear the search bar.

Is there a way to just zoom/pop-up (and not select)?
Or to clear the selection?
Or to clear the Search bar automatically? (collapsing the widget doesn't do it).

thanks,

~stefan (JS rookie)

Tags (1)
0 Kudos
1 Reply
UndralBatsukh
Esri Regular Contributor

Hi there, 

Hope I did not misunderstand you request. Sounds like you want to zoom to the search location and show the popup but does not want to the point graphic at the location. If this is what you want to you can just the Search.resultGraphicEnabled to false in the widget's constructor.

 

const searchWidget = new Search({
  view: view,
  resultGraphicEnabled: false
});