AnsweredAssumed Answered

search widget:  Custom Geocoding Service not working

Question asked by sinharcgis on Nov 13, 2015
Latest reply on Nov 15, 2015 by rscheitlin

my code:


<html dir="ltr">




   <link rel="stylesheet" href="">




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

   <link rel="stylesheet" href="">




      #map {

         height: 100%;

         width: 100%;

         margin: 0;

         padding: 0;


      #search {

         display: block;

         position: absolute;

         z-index: 2;

         top: 20px;

         left: 74px;








<script src=""></script>



        "esri/map", "esri/tasks/locator", "esri/graphic", "esri/dijit/Search", "esri/layers/FeatureLayer", "esri/InfoTemplate",

        "esri/geometry/webMercatorUtils", "esri/layers/ArcGISTiledMapServiceLayer",

        "esri/symbols/SimpleMarkerSymbol", "esri/symbols/SimpleLineSymbol",

        "esri/InfoTemplate", "esri/Color",

        "dojo/number", "dojo/parser", "dojo/dom", "dijit/registry",

        "dijit/layout/BorderContainer", "dijit/layout/ContentPane", "dojo/domReady!"

       ], function (

      Map, Locator, Graphic,Search,FeatureLayer, InfoTemplate,

      webMercatorUtils, ArcGISTiledMapServiceLayer,

      SimpleMarkerSymbol, SimpleLineSymbol,

      InfoTemplate, Color,

      number, parser, dom, registry

    ) {

           var map = new Map("map", {



               zoom: 5


           var tiled = new ArcGISTiledMapServiceLayer("http://localhost:6080/arcgis/rest/services/Atlas2015/NEN_KTXH_150715/MapServer");


           var locator = new Locator("http://localhost/arcgis/rest/services/Geocode/GEOCODING_SONHA_BH/GeocodeServer");

           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");       




               locator: locator,

               outFields: ["*"],

               name: "Custom Geocoding Service",

               placeholder: "Search Geocoder",

               maxResults: 3,

               maxSuggestions: 6,

               enableSuggestions: true,

               minCharacters: 3





               featureLayer: new FeatureLayer("http://localhost/arcgis/rest/services/Atlas2015/NEN_KTXH_150715/MapServer/0"),

               searchFields: ["*"],

               displayField: "TEN",

               exactMatch: true,            

               outFields: ["*"],

               placeholder: "number house",

               maxResults: 6,

               maxSuggestions: 6,



               //Create an InfoTemplate



               infoTemplate: new InfoTemplate("tên: ${TEN}</br>địa chỉ: ${DIACHI}</br>"),



               enableSuggestions: true,

               minCharacters: 0




           //Set the sources above to the search widget

           s.set("sources", sources);












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

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