I am trying to reproduce the tutorial on one of my own layers


I have put in one of my own layers

    <!DOCTYPE html>
<html><link rel="stylesheet" href="http://js.arcgis.com/3.13/esri/css/esri.css">
       <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
       <meta name="viewport" content="initial-scale=1, maximum-scale=1,user-scalable=no" />
       <title>ArcGIS API for JavaScript | Search widget with multiple sources</title>
       <link rel="stylesheet" href="http://js.arcgis.com/3.13/dijit/themes/claro/claro.css">
       <link rel="stylesheet" href="http://js.arcgis.com/3.13/esri/css/esri.css">
          #map {
             height: 100%;
             width: 100%;
             margin: 0;
             padding: 0;
          #search {
             display: block;
             position: absolute;
             z-index: 2;
             top: 20px;
             left: 74px;

    <script src="http://js.arcgis.com/3.13/"></script>
            "esri/map", "esri/dijit/Search", "esri/layers/FeatureLayer", "esri/InfoTemplate", "esri/SpatialReference", "esri/geometry/Extent", "dojo/domReady!"
          ], function (Map, Search, FeatureLayer, InfoTemplate, SpatialReference, Extent) {
             var map = new Map("map", {
                basemap: "gray",
                center: [-97, 38], // lon, lat
                zoom: 5

             var s = new Search({
                enableButtonMode: true, //this enables the search widget to display as a single button
                enableLabel: false,
                enableInfoWindow: true,
                showInfoWindowOnSelect: false,
                map: map
             }, "search");

             var sources = s.get("sources");

             //Push the sources used to search, by default the ArcGIS Online World geocoder is included. In addition there is a feature layer of US congressional districts. The districts search is set up to find the "DISTRICTID". Also, a feature layer of senator information is set up to find based on the senator name. 

                featureLayer: new FeatureLayer("http://services.arcgis.com/V6ZHFr6zdgNZuVG0/arcgis/rest/services/CongressionalDistricts/FeatureServer/0"),
                searchFields: ["DISTRICTID"],
                displayField: "DISTRICTID",
                exactMatch: false,
                outFields: ["DISTRICTID", "NAME", "PARTY"],
                name: "Congressional Districts",
                placeholder: "3708",
                maxResults: 6,
                maxSuggestions: 6,

                //Create an InfoTemplate and include three fields
                infoTemplate: new InfoTemplate("Congressional District", "District ID: ${DISTRICTID}</br>Name: ${NAME}</br>Party Affiliation: ${PARTY}"),
                enableSuggestions: true,
                minCharacters: 0

                featureLayer: new FeatureLayer("http://maps.eastriding.gov.uk/arcgis/rest/services/GISIntranet/MapServer/0"),
                searchFields: ["ADDRESS_WITHOUT_BREAKS"],
                displayField: "ADDRESS_WITHOUT_BREAKS",
                exactMatch: false,
                name: "ADDRESS_WITHOUT_BREAKS",
                outFields: ["*"],
                placeholder: "ADDRESS_WITHOUT_BREAKS",
                maxResults: 6,
                maxSuggestions: 6,

                //Create an InfoTemplate

                //infoTemplate: new InfoTemplate("Senator information", "Name: ${Name}</br>State: ${State}</br>Party Affiliation: ${Party}</br>Phone No: ${Phone_Number}<br><a href=${Web_Page} target=_blank ;'>Website</a>"),

                enableSuggestions: true,
                minCharacters: 0

             //Set the sources above to the search widget
             s.set("sources", sources);



       <div id="search"></div>
       <div id="map"></div>


but when I start typing in the text box it does not create a dropdown list. I cannot see a difference from my source to the other source that gives you a dropdown list

  • Check your dev tools and see if you're getting an error and your network traffic to see if you're getting the required resources. I copied your code above and was able to get results from the world geocoder. – Branco Apr 24 '15 at 14:15
  • @Branco Thanks for your reply. I have no problem with the geocoder and the Congressional District search. When you start typing in the box on both of those layers will start displaying a suggestion under the box (its like autocomplete). It is when I select my layer there is no suggestion . There is no errors in the dev tools and when I look at the network, each letter you type will fire a search on the geocode but not on my own (ADDRESS_WITHOUT_BREAKS). If you blindly type in a search on my layer and hit enter it will search the layer and zoon to point. Its just that autocomplete wont work. – Easty Apr 27 '15 at 8:39
  • I have the same issue to address here. I can't use suggestion because our ArcGIS server is 10.2 but the first retrieve value is not necessarily what I need. Do you have another approach? – André Andrade Jun 12 '15 at 18:36
  • I have a feature service published with ArcGIS Server 10.3 but I am having the issues described by Easty :( – user60449 Oct 8 '15 at 12:34
  • This does not really answer the question. If you have a different question, you can ask it by clicking Ask Question. You can also add a bounty to draw more attention to this question once you have enough reputation. – Evil Genius Oct 8 '15 at 14:12

As noted in the API reference for Search:

"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."

This means you need with a Feature Service published to ArcGIS Online or version 10.3 of ArcGIS Server.

I think it would be pretty helpful for the doc specific to 'sources' > enableSuggestions linked to the same so i'll inform the team.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.