-
Notifications
You must be signed in to change notification settings - Fork 5
/
search.js
42 lines (36 loc) · 1.12 KB
/
search.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
define([
'./map.js',
'esri/dijit/Search',
'esri/layers/FeatureLayer'
], function (map, Search, FeatureLayer) {
var search = new Search({
enableButtonMode: false, //this enables the search widget to display as a single button
map: map,
expanded: true,
minCharacters: 3,
enableSourcesMenu: false,
allPlaceholder: 'Search for an address or restaurants',
enableHighlight: false,
autoNavigate: false,
autoSelect: false
}, 'search');
var sources = search.get('sources');
// push our source at the top of the sources list
sources.unshift({
featureLayer: new FeatureLayer('http://services.arcgis.com/rOo16HdIMeOBI4Mb/arcgis/rest/services/Oldest_Surviving_Los_Angeles_Restaurants/FeatureServer/0'),
searchFields: ['name', 'year', 'description'],
displayField: 'name',
exactMatch: false,
outFields: ['*'],
name: 'Restraunts',
placeholder: 'Search Restraunts',
maxResults: 6,
maxSuggestions: 6,
enableSuggestions: true,
minCharacters: 3
});
//Set the sources above to the search widget
search.set('sources', sources);
search.startup();
return search;
});