Search
The Search widget provides a way to perform search capabilities based on locator services, map service feature layers, and feature service feature layers. These specified sources determine what is searchable in the search box. If you're using a locator with a geocoding service, the findAddressCandidates operation is used, whereas queries are used on feature layers.
The Search widget replaces the Geocoder widget. The main difference is that the Search widget provides additional functionality that allows searching and suggestions on multiple sources.
Configurable attributes
The following table describes the configurable attributes of the Search widget.
Attribute | Description |
---|---|
allPlaceholder | String. Displays the placeholder text when users select All from the source list. |
showInfoWindowOnSelect | Boolean. Indicates whether to show the infoWindow when a result is selected. |
Sources | Object[]. There is no default. An array of source objects used to find search results. See the ArcGIS API for Java Script sources property for details.
|
Example
{
"allPlaceholder": "All Cities",
"showInfoWindowOnSelect": true,
"sources": [{
"url": "https://geocode.arcgis.com/arcgis/rest/services/World/GeocodeServer",
"name": "Esri World Geocoder",
"singleLineFieldName": "SingleLine",
"placeholder": "Esri World Geocoder",
"countryCode": "",
"maxResults": 6,
"type": "locator"
}, {
"layerId": "DistributionFacilities_4577",
"url": "http://tmelectric.esri.com/arcgis/rest/services/DistributionFacilities/MapServer/13",
"name": "DistributionFacilities - Pole",
"placeholder": "Pole",
"searchFields": ["FACILITYID"],
"displayField": "FACILITYID",
"exactMatch": false,
"maxResults": 6,
"type": "query"
}]
}