<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Search Widget disable or clear highlight of results in map in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/search-widget-disable-or-clear-highlight-of/m-p/1615276#M87162</link>
    <description>&lt;P&gt;My bad, just saw you were using 4.31.&amp;nbsp; I'll check the samples with that version.&lt;/P&gt;</description>
    <pubDate>Fri, 16 May 2025 00:24:20 GMT</pubDate>
    <dc:creator>JoelBennett</dc:creator>
    <dc:date>2025-05-16T00:24:20Z</dc:date>
    <item>
      <title>Search Widget disable or clear highlight of results in map</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/search-widget-disable-or-clear-highlight-of/m-p/1615103#M87158</link>
      <description>&lt;P&gt;After hours of research I unfortunately do not find a solution and could need some help.&lt;/P&gt;&lt;P&gt;When using the search widget any resulting features from the search is highlighted in the map:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="SebastianKrings_0-1747331633401.png" style="width: 156px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/132329i297CF7ACA4C1FB26/image-dimensions/156x162?v=v2" width="156" height="162" role="button" title="SebastianKrings_0-1747331633401.png" alt="SebastianKrings_0-1747331633401.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I would like to disable that or clear that afterwards.&lt;/P&gt;&lt;P&gt;I tried disabling it using 'resultGraphicEnabled: false' but without luck. The highlight still appears.&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;const searchWidget = new Search({
	view: mapView,
	popupEnabled: false, //disable single-popup for selected result
	includeDefaultSources: false, //disable default esri world locator service
	allPlaceholder: placeholderText, //only applies if an all-option is available (at least two resources must be in place)
	resultGraphicEnabled: false, // do not highlight features on map
	locationEnabled: false,
	goToOverride: (_view, parameters) =&amp;gt; { .... },
	sources,
	container: this.elementRefSearch!.nativeElement
});&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I also tried to clear the selection using '&lt;SPAN&gt;searchWidget.clear()&lt;/SPAN&gt;&lt;SPAN&gt;'. This clears the search term but the highlight keeps being in the map.&lt;/SPAN&gt;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;searchWidget.on("search-complete", async (_) =&amp;gt; {
	searchWidget.clear();
});&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If I do nothing of this by clear the search by hind by hitting the X button right next to the search term the highlighting disappears just as desired. I would have expected that at least searchWidget.clear() would exactly do this job but looks like it doesnt.&lt;/P&gt;&lt;P&gt;Maybe the search-complete event is not far enough at the end of the event stack. Maybe the highlight happens right after this event is finally handled. So the clear-call would happen right before that while the highlight still happens afterwards, even the search got cleared. Dunno, just wild guesses.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hopefully someone has got an idea for me. Thanks.&lt;/P&gt;</description>
      <pubDate>Thu, 15 May 2025 18:05:01 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/search-widget-disable-or-clear-highlight-of/m-p/1615103#M87158</guid>
      <dc:creator>SebastianKrings</dc:creator>
      <dc:date>2025-05-15T18:05:01Z</dc:date>
    </item>
    <item>
      <title>Re: Search Widget disable or clear highlight of results in map</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/search-widget-disable-or-clear-highlight-of/m-p/1615227#M87159</link>
      <description>&lt;P&gt;It seems to me that setting&amp;nbsp;&lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search.html#resultGraphicEnabled" target="_self"&gt;resultGraphicEnabled&lt;/A&gt; to false should have done it, but since it didn't, there are alternatives.&amp;nbsp; For example, &lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search.html#sources" target="_self"&gt;sources&lt;/A&gt; is a collection of &lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-SearchSource.html" target="_self"&gt;SearchSource&lt;/A&gt; objects.&amp;nbsp; Each of those has its own&amp;nbsp;&lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-SearchSource.html#resultGraphicEnabled" target="_self"&gt;resultGraphicEnabled&lt;/A&gt; property, so you might try setting those to false.&lt;/P&gt;&lt;P&gt;If that doesn't work, SearchSource objects also have a&amp;nbsp;&lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-SearchSource.html#resultSymbol" target="_self"&gt;resultSymbol&lt;/A&gt; property that allows you to define the appearance of the selection symbol.&amp;nbsp; You might try setting that property with a completely transparent symbol.&amp;nbsp; For example:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;//SimpleMarkerSymbol for points
{
	type: "simple-marker",
	style: "square",
	color: [0,0,0,0],
	size: "8px",
	outline: {
		color: [0,0,0,0],
		width: 1
	}
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;or&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;//SimpleFillSymbol for polygons
{
	type: "simple-fill",
	color: [0,0,0,0],
	style: "solid",
	outline: {
		color: [0,0,0,0],
		width: 1
	}
}&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 15 May 2025 21:58:38 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/search-widget-disable-or-clear-highlight-of/m-p/1615227#M87159</guid>
      <dc:creator>JoelBennett</dc:creator>
      <dc:date>2025-05-15T21:58:38Z</dc:date>
    </item>
    <item>
      <title>Re: Search Widget disable or clear highlight of results in map</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/search-widget-disable-or-clear-highlight-of/m-p/1615249#M87160</link>
      <description>&lt;P&gt;When you say '&lt;SPAN&gt;setting&amp;nbsp;&lt;/SPAN&gt;&lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search.html#resultGraphicEnabled" target="_self" rel="nofollow noopener noreferrer"&gt;resultGraphicEnabled&lt;/A&gt;&lt;SPAN&gt;&amp;nbsp;to false should have done it&lt;/SPAN&gt;'&lt;BR /&gt;Doesnt this then sound like a bug?&lt;/P&gt;&lt;P&gt;But when I use this sample and add the property it does not show the result graphics. So that seems to work.&lt;BR /&gt;&lt;A href="https://developers.arcgis.com/javascript/latest/sample-code/widgets-search-multiplesource/" target="_blank"&gt;https://developers.arcgis.com/javascript/latest/sample-code/widgets-search-multiplesource/&lt;/A&gt;&lt;BR /&gt;So may I am missing something. We are using&amp;nbsp;&lt;SPAN&gt;4.31.6.&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;I reduced my code to the following which still does not work.&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;const searchWidget = new Search({
	view: mapView,
	includeDefaultSources: false, //disable default esri world locator service
	allPlaceholder: placeholderText, //only applies if an all-option is available (at least two resources must be in place)
	locationEnabled: false,
	resultGraphicEnabled: false,
	sources,
});

mapView.ui.add(searchWidget, {
  position: "top-right"
});&lt;/LI-CODE&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;The only difference I may can imagine are the sources. I dont see anything obvious in the debugging on the sources data. Here is how we define them.&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;const layerConfig = layerHandle.config;
const searchSourceProperties = {
	layer,
	searchFields: layerConfig.searchFields,
	displayField: layerConfig.displayField,
	name: layerConfig.title,
	exactMatch: false,
	placeholder: layerConfig.searchFields?.join(','),
	outFields: (layerConfig as FeatureLayerConfig)?.outFields,
	suggestionTemplate
};&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Regarding your further suggestions:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;I tried this right before giving sources into the widget creation:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;// disable highlight for every search source
sources.forEach(searchSource =&amp;gt; {
	searchSource.resultGraphicEnabled = false;
});&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;also tried this without any effect:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;const invisible = new SimpleMarkerSymbol({
	type: "simple-marker",
	style: "square",
	color: [0, 0, 0, 0],
	size: "8px",
	outline: {
		color: [0, 0, 0, 0],
		width: 1
	}
});

sources.forEach(searchSource =&amp;gt; {
	searchSource.resultSymbol = invisible;
});&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 15 May 2025 23:37:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/search-widget-disable-or-clear-highlight-of/m-p/1615249#M87160</guid>
      <dc:creator>SebastianKrings</dc:creator>
      <dc:date>2025-05-15T23:37:32Z</dc:date>
    </item>
    <item>
      <title>Re: Search Widget disable or clear highlight of results in map</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/search-widget-disable-or-clear-highlight-of/m-p/1615275#M87161</link>
      <description>&lt;P&gt;It does sound like a bug, but since it works in the samples, I'm not sure what to say about it.&amp;nbsp; Are you also using 4.32?&lt;/P&gt;&lt;P&gt;The code I gave is the "autocast" syntax, so should work without the constructor:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;const invisible = {
	type: "simple-marker",
	style: "square",
	color: [0, 0, 0, 0],
	size: "8px",
	outline: {
		color: [0, 0, 0, 0],
		width: 1
	}
};

sources.forEach(searchSource =&amp;gt; {
	searchSource.resultSymbol = invisible;
});&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm not certain it'll make a difference, but may be worth a try.&amp;nbsp; Other things would be to delete your temporary internet files (i.e. clear your cache), and user your browser's developer tools to ensure you see the latest code, and it's actually being executed by placing breakpoints, etc.&lt;/P&gt;</description>
      <pubDate>Fri, 16 May 2025 00:22:31 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/search-widget-disable-or-clear-highlight-of/m-p/1615275#M87161</guid>
      <dc:creator>JoelBennett</dc:creator>
      <dc:date>2025-05-16T00:22:31Z</dc:date>
    </item>
    <item>
      <title>Re: Search Widget disable or clear highlight of results in map</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/search-widget-disable-or-clear-highlight-of/m-p/1615276#M87162</link>
      <description>&lt;P&gt;My bad, just saw you were using 4.31.&amp;nbsp; I'll check the samples with that version.&lt;/P&gt;</description>
      <pubDate>Fri, 16 May 2025 00:24:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/search-widget-disable-or-clear-highlight-of/m-p/1615276#M87162</guid>
      <dc:creator>JoelBennett</dc:creator>
      <dc:date>2025-05-16T00:24:20Z</dc:date>
    </item>
    <item>
      <title>Re: Search Widget disable or clear highlight of results in map</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/search-widget-disable-or-clear-highlight-of/m-p/1615277#M87163</link>
      <description>&lt;P&gt;Setting resultGraphicEnabled in the sample with 4.31 works as well...&lt;/P&gt;</description>
      <pubDate>Fri, 16 May 2025 00:27:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/search-widget-disable-or-clear-highlight-of/m-p/1615277#M87163</guid>
      <dc:creator>JoelBennett</dc:creator>
      <dc:date>2025-05-16T00:27:12Z</dc:date>
    </item>
    <item>
      <title>Re: Search Widget disable or clear highlight of results in map</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/search-widget-disable-or-clear-highlight-of/m-p/1616915#M87189</link>
      <description>&lt;P&gt;A working demo: &lt;A href="https://codepen.io/edvinasHB/pen/QwweNbO" target="_blank" rel="noopener"&gt;https://codepen.io/edvinasHB/pen/QwweNbO&lt;/A&gt;&lt;/P&gt;&lt;P&gt;I recreated your situation by using the same instance of the feature layer for both map and for search widget. This way Search widget symbol is overriden by Map and instead of showing a custom graphic, it uses highlights from the MapView.&lt;/P&gt;&lt;P&gt;You have two fixes:&lt;/P&gt;&lt;P&gt;1. Create a new instance of the Feature Layer to be used in the Search widget&lt;/P&gt;&lt;P&gt;2. Use the same layer instance, but clear the highlight after selection, like I did in the demo&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;searchWidget.on("select-result", function(event) {
    searchWidget.viewModel.clear()
});&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 21 May 2025 12:55:56 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/search-widget-disable-or-clear-highlight-of/m-p/1616915#M87189</guid>
      <dc:creator>Edvinas_S</dc:creator>
      <dc:date>2025-05-21T12:55:56Z</dc:date>
    </item>
    <item>
      <title>Re: Search Widget disable or clear highlight of results in map</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/search-widget-disable-or-clear-highlight-of/m-p/1617984#M87192</link>
      <description>&lt;P&gt;This is wow.&lt;/P&gt;&lt;P&gt;Your solution just works fine plus you have a good explanation why this indeed is not a bug.&lt;/P&gt;&lt;P&gt;In the meantime I came over with another workaround. A bit dirty but works too.&lt;BR /&gt;I programmatically click the close-button of the search on search-result event.&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;searchWidget.on("select-result", function(_) {
	const clearButton = document.querySelector('.esri-search__clear-button');
	if (clearButton instanceof HTMLButtonElement) {
		clearButton.click();
	}
});&lt;/LI-CODE&gt;&lt;P&gt;Looks like this click causes at least two things processed:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;searchWidget.clear();
searchWidget.viewModel.clear()&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So my final most clean solution now is:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;searchWidget.on("select-result", function(_) {
    searchWidget.clear();
    searchWidget.viewModel.clear();
});&lt;/LI-CODE&gt;</description>
      <pubDate>Fri, 23 May 2025 17:49:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/search-widget-disable-or-clear-highlight-of/m-p/1617984#M87192</guid>
      <dc:creator>SebastianKrings</dc:creator>
      <dc:date>2025-05-23T17:49:00Z</dc:date>
    </item>
  </channel>
</rss>

