require(["esri/dijit/Search"], function(Search) { /* code goes here */ });
Description
(Added at v3.13)
The Search widget provides a way to perform search capabilities based on locator service(s) and/or map/feature service feature layer(s). These specified
sources determine what is searchable within the search box. If using a locator with a geocoding service, the
findAddressCandidates operation is used, whereas queries are used on feature layers.
The Search widget is similar to the
Geocoder widget. The main difference is that it provides additional functionality that allows searching and suggestions on multiple sources. Suggestions are available if working with a 10.3 or later geocoding service that has
suggest
capability loaded or a 10.3 or later feature layer that supports pagination, i.e.
supportsPagination = true
. Also, if using the Esri locator,
suggest
does not have an option to return a number of suggestions.
Note: When using a
Map
with a
SpatialReference
other than Web Mercator or Geographic, be sure to set a default GeometryService. This will ensure that the user's position is returned in the same
SpatialReference
as the
Map
.
require(["esri/config"], function(esriConfig) {
esriConfig.defaults.geometryService = "http://www.example.com/arcgis/rest/services/Utilities/Geometry/GeometryServer";
});
Samples
Search for
samples that use this class.
Constructors
CSS
esri/dijit/Search | Download source
active | Class used to describe the style for the active "Search" button and resulting menu items. |
arcgisSearch | Represents an instance of the node where the Search widget is rendered. This is the default theme used to uniquely style the widget. |
hasButtonMode | Class indicating whether button mode is displayed. |
hasMultipleSources | Class indicating whether multiple sources are being used. |
hasValue | Class which indicates if there is input text in the widget. |
menuHeader | Class used to style the top header of the search results in the menu. |
moreHeader | Class used to style the "More Results" section in the resulting search popup.
|
moreResults | Class used to indicate whether to display additional results in the resulting search popup.
|
noResultsBody | Class used to style the body of how "No results" is displayed. |
noResultsHeader | Class used to style the header of how "No results" displays. |
noResultsMenu | Class used to style the menu if there are "No results". |
noResultsText | The class used to style the "No results" text. |
noValueIcon | This class is used used if wanting to display a warning icon when no value is entered into the search box. |
noValueText | Class used to style the resulting dialog when no value is entered in the search box. |
popupHeader | Class used to style the popupHeader in the search popup's "More results".
|
resultsList | Class used to style the popup's search results list. |
searchAnimate | Class used to style how the search animation displays. |
searchBtn | Class used to style the Search button. |
searchButtonText | The class used to style how the "Search" button displays its text. |
searchClear | The class used to style the "Clear search" (x) area of the widget. |
searchClearFloat | Used to clear floats in the Search widget. |
searchClearIcon | esriIconCancel | Class used to style the clear icon. |
searchCollapsed | Class used to indicate whether the search is collapsed. |
searchExpandContainer | Containing class for when the widget is expanded.
|
searchExpanded | Class used to indicate whether the search is expanded. |
searchGroup | Class used to style the elements used for the input text and search. |
searchIcon | esriIconZoom | Class used to style the search icon.
.arcgisSearch .searchIcon {
color:orange;
font-size:20px;
}
|
searchInput | Class used to style the search input box. |
searchInputGroup | Class used to style the grouping of input elements. |
searchLoading | Class used to indicate that the search is loading. |
searchMenu | Class used to style the resulting search results menu. |
searchSubmit | Class used to style the Search's submit button when collapsed. |
searchToggle | Class used to style how the toggle button displays. |
searchToggleIcon | esriIconDownDir | Class used to style the toggle icon.
.arcgisSearch .esriIconDownDir{
color: #ccc;
}
|
showMoreResults | Class used to indicate if showing more results in the search result popup. |
showNoResults | Class indicating whether to display "No results". |
showSources | Class indicating whether to display sources. |
showSuggestions | Class indicating whether to show suggestions for text input. |
sourceName | Class used to style how the source name is displayed. |
sourcesMenu | Class used to style the drop-down menu listing all available sources. |
suggestionsMenu | Class used to style the drop-down menu for suggestions. |
Properties
Methods
Events
[ On Style Events | Connect Style Event ]
All On Style event listeners receive a single event object. Additionally, the event object also contains a 'target' property whose value is the object which fired the event.
Events
blur | | Fired when the widget's text input loses focus. |
clear-search | | Fired when a result is cleared from the input box or a new result is selected.Please note that Internet Explorer fires this event if either sources or activeSourceIndex properties are set via the set method.. |
focus | | Fired when the widget's text input sets focus. |
load | | Fired when the search widget has fully loaded. |
search-results | {
activeSourceIndex: <Number >,
errors: <Error[] >,
numErrors: <Number >,
numResults: <Number >,
results: <Object[] >,
value: <String >
} | Fires when the search method is called and returns its results. |
select-result | {
result: <Object >,
source: <Object >,
sourceIndex: <Number >
} | Fired when a search result is selected. |
suggest-results | {
activeSourceIndex: <Number >,
errors: <Error[] >,
numErrors: <Number >,
numResults: <Number >,
results: <Object[] >,
value: <String >
} | Fired when the suggest method is called and returns its results. |
Old Events
onBlur() | Fired when the widget's text input loses focus. |
onClearSearch() | Fired when a result is cleared from the input box or a new result is selected. |
onFocus() | Fired when the widget's text input sets focus. |
onLoad() | Fired when the Search widget has fully loaded. |
onSearchResults(activeSourceIndex, numResults, numErrors, errors, results, value) | Fired when the search method is called and returns its results. |
onSelectResult(result, source, sourceIndex) | Fired when a search result is selected. |
onSuggestResults(activeSourceIndex, numResults, numErrors, errors, results, value) | Fired when the suggest method returns is called and returns its results. |
Constructor Details
Create a new Search widget using the given DOM node.
Parameters:
<Object > options |
Required |
Set of options used to specify Search options. This parameter is required but can be null or an empty object. See the options properties below for details. |
<Node | String > srcNode |
Required |
Reference or id of the HTML element where the widget should be rendered. |
options
properties:
<Number | String > activeSourceIndex |
Optional |
The currently selected source. The default is "all". |
<Boolean > addLayersFromMap |
Optional |
Indicates whether to automatically add all the feature layers from the map. The default value is false. |
<String > allPlaceholder |
Optional |
This is the default value used as a hint for input text when searching on multiple sources. The default value is "Find address or place". |
<Boolean > autoNavigate |
Optional |
Indicates whether to automatically navigate to the selected result. The default value is true. |
<Boolean > autoSelect |
Optional |
Indicates whether to automatically select the first geocoded result (not the first suggestion). The default value is true. |
<Boolean > enableButtonMode |
Optional |
Indicates whether to enable an option to collapse/expand the search into a button. The default value is false. |
<Boolean > enableHighlight |
Optional |
Indicates whether to show the selected feature on the map using the highlight symbol property. The default value is true. |
<Boolean > enableInfoWindow |
Optional |
Indicates whether to display the infoWindow on feature click. The default value is true. See the enableInfoWindow property for additional information on this. |
<Boolean > enableLabel |
Optional |
Indicates whether to enable showing a label for the geometry.The default value is false. |
<Boolean > enableSearchingAll |
Optional |
Indicates whether to display the option to search "All" sources. Default is true . |
<Boolean > enableSourcesMenu |
Optional |
Indicates whether to enable the menu for selecting different sources. The default value is true. |
<Boolean > enableSuggestions |
Optional |
Indicates whether or not to enable suggest on the widget. The default value is true.
NOTE: This is available if working with a 10.3 or later geocoding service that has suggest capability loaded or a 10.3 or later feature layer that supports pagination, i.e. supportsPagination = true . |
<Boolean > enableSuggestionsMenu |
Optional |
Indicates whether to display suggest results. The default value is true. |
<Boolean > expanded |
Optional |
Indicates whether to set the state of the enableButtonMode to expanded (true) or collapsed (false). The default value is false. |
<Layer > graphicsLayer |
Optional |
This the specified graphicsLayer to use for the highlightGraphic and labelGraphic instead of map.graphics. |
<InfoTemplate > infoTemplate |
Optional |
A customized infoTemplate for the selected feature.
NOTE: Do not specify a wildcard "${*}" for this specific infoTemplate as it will return all fields in addition to search-specific fields. |
<TextSymbol > labelSymbol |
Optional |
The text symbol for the label graphic. |
<Number > locationToAddressDistance |
Optional |
The default distance specified in meters used to reverse geocode, (if not specified by source). The default value is 1500. |
<Map > map |
Optional |
Reference to the map. If no map is specified, the value is null. |
<Number > maxResults |
Optional |
The default maximum number of results returned by the widget if not specified by source. The default value is 6. |
<Number > maxSuggestions |
Optional |
The default maximum number of suggestions returned by the widget if not specified by source. The default value is 6. NOTE: If working with the default ArcGIS Online Geocoding service, the default remains at 5. |
<Number > minCharacters |
Optional |
The default minimum amount of characters needed for the search if not specified by source. The default value is 1. |
<Boolean > showInfoWindowOnSelect |
Optional |
Indicates whether to show the infoWindow when a result is selected. The default value is true. See the showInfoWindowOnSelect property for additional information on this. |
<Object[] > sources |
Optional |
An array of source objects used to find search results. Refer to the sources property for additional information on this. |
<Number > suggestionDelay |
Optional |
The millisecond delay after keyup and before making a suggest network request. The default value is 150. |
<String > theme |
Optional |
The CSS class selector used to uniquely style the widget. The default value is arcgisSearch. |
<String > value |
Optional |
Current value of the search box input text string. The default value is "". |
<Boolean > visible |
Optional |
Indicates whether to show the Search widget. Default value is true. |
<Number > zoomScale |
Optional |
If the result does not have an associated extent, specify this number to use as the zoom scale for the result. The default value is 1000. |
Sample:
require([
"esri/map", "esri/dijit/Search", ...
], function(Map, Search, ...) {
var map = new Map(...);
var s = new Search({
map: map
},"search");
});
Property Details
Read-only property of the source object currently selected. Can be either a feature layer or locator task.
The currently selected source. The default is 0. When
sources
is set(),
activeSourceIndex
will be set to 0 if the
sources
length is 1. Otherwise, it will be set to "all".
Please note that Internet Explorer fires a clear-search event if either the sources
property or this property is set via the set
method. (Added at v3.14)
Indicates whether to automatically add all the feature layers from the map.
Default value: false
This is the default value used as a hint for input text when searching on multiple sources. The default value is "Find address or place". (Added at v3.15)
Default value: "Find address or place"
Indicates whether to automatically navigate to the selected result.
Default value: true
Indicates whether to automatically select the first geocoded result. If
false
, the
findAddressCandidates operation will still geocode the input string, but the top result will not be selected. To work with the geocoded results, you can set up a
search-results event handler and get the results through the event object.
Default value: true
(Read-only), the default source used for the Search widget. (Added at v3.15)
Default value: ArcGIS Online World Geocoding Service
Indicates whether to enable an option to collapse/expand the search into a button.
Default value: false
Show the selected feature on the map using a default symbol determined by the source's geometry type.
Default value: true
Indicates whether to display the infoWindow on feature click. The graphic can be clicked to display an info window. This is not the same as using
showInfoWindowOnSelect which opens the info window any time a search is performed.
Note: It is possible to have
showInfoWindowOnSelect=false
but
enableInfoWindow=true
so that the info window can be opened by someone but it is not open by default.
Default value: true
Indicates whether to enable showing a label for the geometry.
Default value: false
Indicates whether to display the option to search "All" sources. Default is true
. (Added at v3.15)
Default value: true
Indicates whether to enable the menu for selecting different sources.
Default value: true
Enable suggestions for the widget.
NOTE: This is available if working with a 10.3 or later geocoding service that has suggest
capability loaded or a 10.3 or later feature layer that supports pagination, i.e. supportsPagination = true
.
Default value: true
Indicates whether to display
suggest results.
NOTE: Suggestions are available if working with a 10.3 or later geocoding service that has
suggest
capability loaded or a 10.3 or later feature layer that supports pagination, i.e.
supportsPagination = true
.
Default value: true
Indicates whether to set the state of the enableButtonMode to expanded (true) or collapsed (false).
Default value: false
Read-only property indicating the highlighted location graphic.
A customized
infoTemplate for the selected feature.
NOTE: Do not specify a wildcard "${*}" for this specific infoTemplate as it will return all fields in addition to search-specific fields.
Read-only graphic property for the text label.
Read-only property indicating whether the widget is loaded.
The default distance specified in meters used to reverse geocode (if not specified by source). (Added at v3.15)
Default value: 1500
Reference to the map. If not map specified, value is null.
The default maximum number of results returned by the widget if not specified by source.
Default value: 6
The default maximum number of suggestions returned by the widget if not specified by source. NOTE: If working with the default ArcGIS Online Geocoding service, the default remains at 15.
Default value: 6
The default minimum number of characters needed for the search if not specified by source.
Default value: 1
Read-only property that returns an array of current results from the search.
Indicates whether to show the infoWindow when a result is selected. Using
showInfoWindowOnSelect opens the info window any time a search is performed.
Note: It is possible to have
showInfoWindowOnSelect=false
but
enableInfoWindow=true
so that the info window can be opened by someone but it is not open by default.
Default value: true
An array of source objects used to find search results.
Multiple geocoding services are supported in addition to searching feature layers. See the object specifications table below for the structure of the sources object.
Default sources[]
[
{
locator: new Locator("https://geocode.arcgis.com/arcgis/rest/services/World/GeocodeServer"),
singleLineFieldName: "SingleLine",
outFields: ["Addr_type"],
name: i18n.widgets.Search.main.esriLocatorName,
localSearchOptions: {
minScale: 300000,
distance: 50000
},
placeholder: i18n.widgets.Search.main.placeholder,
highlightSymbol: new PictureMarkerSymbol(this.basePath + "/images/search-pointer.png", 36, 36).setOffset(9, 18)
}
]
Example sources[]
var sources = [
{
locator: ,
locationType: "street",
singleLineFieldName: "SingleLine",
name: "Custom Geocoding Service",
localSearchOptions: {
minScale: 300000,
distance: 50000
},
placeholder: "Search Geocoder",
maxResults: 3,
maxSuggestions: 6,
enableSuggestions: false,
minCharacters: 0
}, {
featureLayer: new FeatureLayer("http://services.arcgis.com/V6ZHFr6zdgNZuVG0/arcgis/rest/services/US_Senators/FeatureServer/0"),
searchFields: ["Name", "Party"],
suggestionTemplate: "${Name}, Party: ${Party}",
exactMatch: false,
outFields: ["*"],
name: "Senators",
labelSymbol: textSymbol,
placeholder: "Senator name",
maxResults: 6,
maxSuggestions: 6,
enableSuggestions: true,
minCharacters: 0,
localSearchOptions: {distance: 5000},
},
{
featureLayer: new FeatureLayer(),{
outFields: ["*"]
});
placeholder: "esri",
name: "A FeatureLayer",
prefix: "",
suffix: "",
maxResults: 1,
maxSuggestions: 6,
exactMatch: false,
searchFields: [], // defaults to FeatureLayer.displayField
displayField: "", // defaults to FeatureLayer.displayField
labelSymbol: new TextSymbol(),
minCharacters: 0
}
];
There are a few ways to set the sources:
- Set source(s) on creation
var s = new Search({
sources: []
});
s.startup();
- Add to sources
var s = new Search();
var sources = s.get("sources");
sources.push({//new source});
s.set("sources", sources);
s.startup();
- Set sources
var s = new Search();
var sources = [my sources];
s.set("sources", sources);
s.startup();
Please note that Internet Explorer fires a clear-search event if either sources
or activeSourceIndex
properties are set via the set
method.
When working with multiple sources, there may be instances when needing to listen for when the source changes. If this is the case, the following snippet of code will do this:
search.watch("activeSourceIndex", function(){
var activeSource = search.activeSource//.name;
console.log("Current Source", activeSource);
});
Default value: ArcGIS Online World Geocoding Service
Object Specifications: <localSearchOptions
>
<Number > distance |
Required |
Specify a search distance for the location search. The default value is 12,000 meters. |
<Number > minScale |
Required |
Location search will be performed when the map scale is less than the specified value. The default minScale is 15,000. |
<sources
>
<Boolean > autoNavigate |
Required |
Applies to both locators and feature layer sources. This indicates whether to automatically navigate to the selected result once selected. The default is true. |
<String[] > categories |
Required |
A string array which limits the results to one or more categories. For example "Populated Place" or "airport". Only applicable when using the World Geocode Service. View the World Geocoding Service documentation for more information. |
<String > countryCode |
Required |
Applies only when working with locator sources. This constricts search results to a specified country code. For example, "US" for United States or "SE" for Sweden. Only applies to the World Geocode Service. View the World Geocoding Service documentation for more information. |
<String > displayField |
Required |
Applies to only feature layer sources. The results are displayed using this field. Defaults to the layer's displayField or the first string field. |
<Boolean > enableHighlight |
Required |
Applies to both locators and feature layer sources. This indicates whether to show a graphic on the map for the selected source using its highlightSymbol. The default value is true. |
<Boolean > enableInfoWindow |
Required |
Applies to both locators and feature layer sources. It displays an info window when a selected result is clicked. The default is true. |
<Boolean > enableLabel |
Required |
Applies to both locators and feature layer sources. This indicates whether to show a text label on the map for the selected source using labelSymbol. The default value is false. |
<Boolean > enableSuggestions |
Required |
Applies to both locators and feature layer sources. This indicates whether to enable suggestions for the widget user input. The default value is true.
NOTE: This is available if working with a 10.3 geocoding service that has suggest capability loaded or a 10.3 feature layer that supports pagination, i.e. supportsPagination = true . |
<Boolean > exactMatch |
Required |
Applies only to feature layer source. This only return results that match the search value exactly. Default is false . |
<FeatureLayer > featureLayer |
Required |
This applies only to map service feature layer sources. The feature layer is queried in the search. If searching feature layers, this is required. |
<String > highlightSymbol |
Optional |
The symbol used for highlightGraphic. If not specified, it renders using smart mapping defaults. |
<InfoTemplate > infoTemplate |
Required |
The InfoTemplate used for the selected result. This applies to both locators and feature layer sources. |
<TextSymbol > labelSymbol |
Required |
The TextSymbol used to label the selected result. This applies to both locators and feature layer sources. |
<Object > localSearchOptions |
Optional |
Applies only when working with locator sources. This is used to set the sources for local distance and minScale for searching. See the localSearchOptions table below for details. |
<Number > locationToAddressDistance |
Optional |
The default distance specified in meters used to reverse geocode. The default is 1500. |
<String > locationType |
Optional |
Define the type of location, either "street" or "rooftop", of the point returned from the World Geocoding Service. |
<Locator > locator |
Required |
This applies only to locator sources. It is the locator task used to search. This is required and defaults to the World Geocoding Service. |
<Number > maxResults |
Required |
Applies to both locators and feature layer sources. This number indicates the maximum number of results to return. The default value is 6. |
<Number > maxSuggestions |
Required |
Applies to both locators and feature layer sources. This number indicates the maximum number of suggestions to return for the widget's input. The default value is 15. |
<Number > minCharacters |
Required |
Applies to both locators and feature layer sources. This number indicates the minimum number of characters required before querying for a suggestion. The default value is 1. |
<String > name |
Required |
Applies to both locators and feature layer sources. This is the name of the source for display. |
<String[] > outFields |
Required |
This string array applies to both locators and feature layer sources. It specifies the fields returned with the search results. |
<String > placeholder |
Required |
Applies to both locators and feature layer sources. This is used as a hint for the source input text. Not supported by IE9 and below. |
<String > prefix |
Required |
Applies to both locators and feature layer sources. Specify this to prefix the input for the search text. |
<String[] > searchFields |
Required |
Applies only to feature layer sources. It is an array of string values to search for results within these feature layer fields. |
<String > searchTemplate |
Optional |
(Added at v. 3.15) Applicable when working with reverse geocoding. A template string used to customize the value for the returned geocoded address. It provides flexibility with how the string gets constructed, i.e. what fields are used, in which order, and with which delimiters.
NOTE: It is important to note that if a searchTemplate is not specified, the geocoded address may not display as expected, for example coordinates instead of an address string. Also, field names must use the following convention in the string: "${FieldName}" . |
<Boolean > showInfoWindowOnSelect |
Required |
Applies to both locators and feature layer sources. This indicates whether to show the info window when a result is selected. The default value is true. |
<String > singleLineFieldName |
Required |
This applies only to locator sources. It is the field name of the Single Line Address Field in the REST services directory for the locator service. Common values are "SingleLine" and "SingleLineFieldName". |
<String > suffix |
Required |
Applies to both locators and feature layer sources. Specify this to suffix the input for the search text. |
<String > suggestionTemplate |
Optional |
(Added at v. 3.14) A template string used to display multiple fields in a defined order. This only works with feature layer sources and takes precedence over displayField . |
<Boolean > useMapExtent |
Required |
Indicates whether to constrain the search results to the map's extent. |
<Number > zoomScale |
Optional |
Applicable to the specified source. If the result does not have an associated extent, specify this number to use as the zoom scale for the result. |
Read-only property that returns an array of current results from the
suggest.
NOTE: This is available if working with a 10.3 or later geocoding service that has suggest
capability loaded or a 10.3 or later feature layer that supports pagination, i.e. supportsPagination = true
.
The millisecond delay after
keyup
and before making a
suggest network request.
Default value: 150
The CSS class selector used to uniquely style the widget.
Default value: arcgisSearch
The current value of the search box input text string.
Default value: ""
Indicate whether to show the widget.
Default value: true
If the result does not have an associated extent, specify this number to use as the zoom scale for the result.
Default value: 1000
Method Details
Unfocus the widget's text input.
Clears the current value, search results, suggest results, graphic, and/or graphics layer. It also hides any open menus.
Closes the widget from button mode. This requires enableButtonMode
to be true.
Destroys the Search widget. Call destroy() when the widget is no longer needed by the application.
Sample:
var s = new Search({
sources: []
});
s.startup();
/// widget no longer needed
s.destroy();
Opens the widget from button mode. It requires enableButtonmode
to be true.
Brings focus to the widget's text input.
Get the value of the property from the Search widget. Full list of properties provided in the Properties listed for this class.
Parameters:
<String > name |
Required |
String value indicating the property to get. |
Depending on the sources specified, search() queries the feature layer(s) and/or performs address matching using any specified
Locator(s) and returns any applicable results. The search() uses whatever the current value is set for the widget, or if desired, a value can be passed to it.
Parameters:
<String | Geometry | Object | Number[] > value |
Optional |
This value can be a string, geometry, suggest candidate object, or an array of [latitude,longitude].
If a geometry is supplied, then it will reverse geocode (locator) or findAddressCandidates with geometry instead of text (featurelayer). |
Sample:
s = new Search({
map: map
}, "search");
s.startup();
// search using point
geo = new Point(-118.15, 33.80, new SpatialReference({
wkid: 4326
}));
s.search(geo).then(function(response){
console.log(response);
});
// search using text
s.search("New York").then(function(response){
console.log(response);
});
// search using current value of widget
s.set("value", "Redlands, CA");
s.search().then(function(response){
console.log(response);
});
Selects a result.
Parameters:
<Object > value |
Required |
The result object to select. |
Sample:
// search using current value of widget
s.set("value", "Redlands, CA");
s.search().then(function(response){
// select the specified result
s.select(response.results[0][0]);
});
Sets the value of a non "read-only" property from the widget.
Finalizes the creation of the Search widget. Call startup() after creating the widget when you are ready for user interaction.
Sample:
var s = new Search({
sources: []
});
s.startup();
Performs a suggest() request on the active
Locator or feature layer. It also uses the current value of the widget or one that is passed in.
NOTE: Suggestions are available if working with a 10.3 geocoding service that has suggest
capability loaded or a 10.3 feature layer that supports pagination, i.e. supportsPagination = true
. Parameters:
<String > value |
Optional |
The string value used to suggest() on an active locator or feature layer. If nothing is passed in, takes the current value of the widget. |
Event Details
[ On Style Events | Connect Style Event ]
Fired when the widget's text input loses focus.
Sample:
require([
...
], function( ... )
on(s,'blur', function(e) {
console.log ('blur');
});
...
});
Fired when a result is cleared from the input box or a new result is selected.
Please note that Internet Explorer fires this event if either sources or activeSourceIndex properties are set via the set
method. Sample:
require([
...
], function( ... )
on(s,'clear-search', function(e) {
console.log ('cleared search');
});
...
});
Fired when the widget's text input sets focus.
Sample:
require([
...
], function( ... )
on(s,'focus', function(e) {
console.log ('focus');
});
...
});
Fired when the search widget has fully loaded.
Fires when the
search method is called and returns its results.
Event Object Properties:
<Number > activeSourceIndex |
The activeSourceIndex of the search result. |
<Error[] > errors |
An array of error objects returned from the search result. |
<Number > numErrors |
The number of errors returned from the search. |
<Number > numResults |
The number of results from the search. |
<Object[] > results |
An array of objects representing the results of the search.
{
results: [
extent: <Extent>,
feature: <Feature>
]
}
|
<String > value |
The string value of the returned search result. |
Sample:
require([
...
], function( ... )
on(s,'search-results', function(e) {
console.log ('search results', e);
});
...
});
Fired when a search result is selected.
Event Object Properties:
<Object > result |
An object containing the results of the search.
{
extent: <Extent>,
feature: <Graphic>,
name: <String>
}
|
<Object > source |
The source of the selected result. Please see sources for additional information on its properties. |
<Number > sourceIndex |
The source index of the selected result. |
Sample:
require([
...
], function( ... )
on(s,'select-result', function(e) {
console.log ('selected result', e);
});
...
});
Fired when the
suggest method is called and returns its results.
Event Object Properties:
<Number > activeSourceIndex |
The activeSourceIndex of the suggest result. |
<Error[] > errors |
An array of error objects returned from the suggested result. |
<Number > numErrors |
The number of errors from the suggest. |
<Number > numResults |
The number of suggest results. |
<Object[] > results |
An array of objects containing the results of suggest().
{
results: [
isCollection: <Boolean>,
magicKey: <String>,
text: <String>
]
}
|
<String > value |
The string value of the returned suggest result. |
Sample:
require([
...
], function( ... )
on(s,'suggest-results', function(e) {
console.log ('suggest results', e);
});
...
});
Fired when the widget's text input loses focus.
Fired when a result is cleared from the input box or a new result is selected.
Fired when the widget's text input sets focus.
Fired when the Search widget has fully loaded.
Fired when the
search method is called and returns its results.
Event Object Properties:
<Number > activeSourceIndex |
The activeSourceIndex of the search result. |
<Number > numResults |
The number of results from the search. |
<Number > numErrors |
The number of errors returned from the search result. |
<Error[] > errors |
An array of error objects returned from the search result. |
<Object > results |
An object containing the results of the search.
{
results: [
extent: ,
feature:
]
}
|
<String > value |
The string value of the returned search result. |
Fired when a search result is selected.
Event Object Properties:
<Object > result |
An object containing the results of the search.
{
extent: <Extent>,
feature: <Graphic>,
name: <String>
}
|
<Object > source |
The source of the selected result. Please see sources for additional information on its properties. |
<Number > sourceIndex |
The source index of the selected result. |
Fired when the
suggest method returns is called and returns its results.
Event Object Properties:
<Number > activeSourceIndex |
The activeSourceIndex of the suggest result. |
<Number > numResults |
The number of suggest results. |
<Number > numErrors |
The number of errors returned from the suggest result. |
<Error[] > errors |
An array of error objects returned from the suggest result. |
<Object > results |
An object containing the suggest results.
{
results: [
isCollection: <Boolean>,
magicKey: <String>,
text: <String>
]
}
|
<String > value |
The string value of the returned suggest result. |