JS API 4.9 : cannot remove Esri World Geocoder from Directions widget

11-27-2018 11:21 AM
Occasional Contributor III


I know directions widget of 4.9 is still in beta but I think it would be interesting to be able to remove the default ESRI world geocoder from the search sources of the widget just like what we can do currently with the property includeDefaultSources of the search.

Currently, defining the sources of the search in the searchProperties property do not overwrite the default ESRI world geocoder but append it and I was not able to find an easy way to remove it as the searches are not "accessible" as a property of the widget. 

I tried to set my source as default with the activeSourceIndex property, but it seems like it is not taken into account.

In the meantime, if you have any idea for a workaround, that would be great !


0 Kudos
2 Replies
New Contributor III

Did you find a solution to this?

0 Kudos
Occasional Contributor III

Oups, apologize for my late reply, I missed that question.

I did find a workaround. The idea is to push your locator in the directionSources property, disable searchAll setting in the Directions widget by setting "searchAllEnabled" property to false and by specifying that the source "activeSourceIndex" is 0.

Here is a snippet:

/* Directions configuration */
const directionSources = new Collection<LocatorSearchSource>();
new LocatorSearchSource({
locator: new Locator({
singleLineFieldName: "ZIPCode",
placeholder: "33 ESRI Road",
outFields: ["Addr_type"],
name: "CustomLocator"

this.directionsWidget = new Directions({
searchProperties: {
sources: directionSources,
searchAllEnabled: false,
activeSourceIndex: 0
Hope that help
0 Kudos