ESM: import SearchSource from "@arcgis/core/widgets/Search/SearchSource.js";
CDN: const SearchSource = await $arcgis.import("@arcgis/core/widgets/Search/SearchSource.js");
Class: @arcgis/core/widgets/Search/SearchSource
Since: ArcGIS Maps SDK for JavaScript 4.0
Property Overview Any properties can be set, retrieved or listened to. See the Watch for changes topic.Show inherited properties Hide inherited properties
Property DetailsIndicates whether to automatically navigate to the selected result once selected.
Inherited
Property declaredClass Stringreadonly
Since: ArcGIS Maps SDK for JavaScript 4.7 Accessor since 4.0, declaredClass added at 4.7.
The name of the class. The declared class name is formatted as esri.folder.className
.
Since: ArcGIS Maps SDK for JavaScript 4.4 SearchSource since 4.0, filter added at 4.4.
For filtering suggests or search results. Setting a value here takes precedence over withinViewEnabled. Please see the object specification table below for details.
The where clause specified for filtering suggests or search results.
optionalThe filter geometry for suggests or search results. Extent is the only supported geometry when working with locator sources. See Find Address Candidates for additional information.
Example
const theExtent = new Extent({
xmin: 11376463,
ymin: -5163501,
xmax: 18890529,
ymax: -662888,
spatialReference: {
wkid: 3857
}
});
const searchExtent = {
geometry: theExtent,
where: "TERRITORY = 'Northern Territory'"
};
const sources = [{
layer: featureLayerTourism,
placeholder: "Darwin",
maxResults: 5,
searchFields: ["POI"],
displayField: "POI",
name: "In a Sunburned Country",
filter: searchExtent
}];
const searchWidget = new Search({
view: view,
sources: sources
});
Function used to get search results. See GetResultsHandler for the function definition. When resolved, returns an object containing an array of search results.
Indicates the maximum number of search results to return.
Indicates the maximum number of suggestions to return for the widget's input.
Indicates the minimum number of characters required before querying for a suggestion.
Specifies the fields returned with the search results.
Used as a hint for the source input text.
Indicates whether to display a Popup when a selected result is clicked.
The popup template used to display search results. If no popup is needed, set the source's popupTemplate to null
.
Specify this to prefix the user's input of the search text.
Indicates whether to show a graphic on the map for the selected source using the resultSymbol.
The symbol used to display the result.
Known Limitations
This property only applies when the layer/locator/source is not part of the map.
Specify this to add a suffix to the user's input for the search value.
Indicates whether to display suggestions as the user enters input text in the widget.
uid Stringreadonly
Since: ArcGIS Maps SDK for JavaScript 4.33 SearchSource since 4.0, uid added at 4.33.
An automatically generated unique identifier assigned to the instance. The unique id is generated each time the application is loaded.
withinViewEnabled Boolean
Indicates whether to constrain the search results to the view's extent.
The set zoom scale for the resulting search result. This scale is automatically honored.
Example
let searchWidget = new Search({
view: view,
sources: [
{
layer: featureLayer,
searchFields: ["Name", "Team"],
name: "LayerSearchSource",
zoomScale: 500000
}
]
});
Show inherited methods Hide inherited methods
Method DetailsInherited
Method addHandles(handleOrHandles, groupKey)
Since: ArcGIS Maps SDK for JavaScript 4.25 Accessor since 4.0, addHandles added at 4.25.
Adds one or more handles which are to be tied to the lifecycle of the object. The handles will be removed when the object is destroyed.
// Manually manage handles
const handle = reactiveUtils.when(
() => !view.updating,
() => {
wkidSelect.disabled = false;
},
{ once: true }
);
this.addHandles(handle);
// Destroy the object
this.destroy();
Parameters
Handles marked for removal once the object is destroyed.
groupKey *
optionalKey identifying the group to which the handles should be added. All the handles in the group can later be removed with Accessor.removeHandles(). If no key is provided the handles are added to a default group.
Creates a new instance of this class and initializes it with values from a JSON object generated from an ArcGIS product. The object passed into the input json
parameter often comes from a response to a query operation in the REST API or a toJSON() method from another ArcGIS product. See the Using fromJSON() topic in the Guide for details and examples of when and how to use this function.
Returns
Type Description * | null | undefined Returns a new instance of this class.Inherited
Method hasHandles(groupKey){Boolean}
Since: ArcGIS Maps SDK for JavaScript 4.25 Accessor since 4.0, hasHandles added at 4.25.
Returns true if a named group of handles exist.
Parameter
groupKey *
optionalA group key.
Returns
Type Description Boolean Returnstrue
if a named group of handles exist.
Example
// Remove a named group of handles if they exist.
if (obj.hasHandles("watch-view-updates")) {
obj.removeHandles("watch-view-updates");
}
Inherited
Method removeHandles(groupKey)
Since: ArcGIS Maps SDK for JavaScript 4.25 Accessor since 4.0, removeHandles added at 4.25.
Removes a group of handles owned by the object.
Parameter
groupKey *
optionalA group key or an array or collection of group keys to remove.
Example
obj.removeHandles(); // removes handles from default group
obj.removeHandles("handle-group");
obj.removeHandles("other-handle-group");
Function definition for the getResults property.
Parameters
Specification
An object that is passed as a parameter to get search results.
Specification
optionalThe key field used to find the result.
optionalThe location value used by the Search.
optionalIndicates the maximum number of search results to return.
optionalIndicates the index of the search source.
optionalIndicates the Spatial Reference defined by the source.
Indicates the Suggest Result that triggered the search for a result.
optionalIndicates the view provided using the source.
Returns
Function definition for the getSuggestions() property.
Parameters
Specification
An object that is passed as a parameter to get search suggestions.
Specification
Indicates search term used to find a suggestion.
optionalIndicates the maximum number of suggestions to return for the widget's input.
optionalIndicates the index of the search source.
optionalIndicates the spatial reference defined by the source.
optionalIndicates the view provided using the source.
Returns
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4