Select to view content in your preferred language

disable Suggestions from Esri locator in Search widget

07-07-2019 10:51 AM
by Anonymous User
Not applicable

This is somewhat of an Idea for a long-term implementation in the Esri World Locator service and/or WebApp Builder.

Question for anyone on WebApp Builder team - can you create a config option or workaround to disable Suggestions for just the Esri World Locator Service for the Search Widget?  Jianxia Song‌  For example, it would be nice if beside each locator in Config, you have a checkbox that says 'Enable Suggestions'.  So they could be enabled for some locators and not others (like in my example, keep them on for my own locators but turn it off for World Locator)  I think for that it will require substantial WAB workaround or adding it to Locators as a URL Parameter in a future Enterprise/Server update to the REST API.

The reason - I do not want Esri results to pop up sometimes in Suggest list; it may be confusing such as for addresses, where if Esri addresses do not exactly coincide with results from our own address locators. You can see why users would be confused. 

I do however want to retain Esri's locator if possible, so that people can search for businesses and POIs with it. I would have stuck a second Search widget with just the Esri locator on the Launchpad toolbar but I would want to hide it, and it it is not possible to squirrel it away in an Advanced group because it is not a panel widget.  

It is possible to disable Suggestions for all locators, by using the following workaround, since it is part of the dijit straight from the API (thank you Cheryl from TS for helpful suggestion) per below.   However, I want to disable Suggestions only for the World Locator.

adding the line as below in Search in widget.js to the dijit object:

enableSuggestions: false,

this.searchDijit = new Search({
activeSourceIndex: searchSouces.length === 1 ? 0 : 'all',
minCharacters: 4, /// kevin override speed up performance to stop it from requesting data until 4 characters entered
allPlaceholder: jimuUtils.stripHTML(esriLang.isDefined(this.config.allPlaceholder) ?
this.config.allPlaceholder : ""),
autoSelect: true,
enableSuggestions: false, // kevin - disable on ALL geocoders
enableButtonMode: false,
enableLabel: false,
enableHighlight: true,
enableInfoWindow: true,
showInfoWindowOnSelect: true,
sources: searchSouces,
theme: 'arcgisSearch'
});, this.searchNode);

0 Replies