Hide Table of Contents
View Search using a suggestion template sample in sandbox
Search using a suggestion template


This sample demonstrates how you can work with a suggestion template when using the Search widget. At 3.14, a constructor option was added to thesource. The suggestionTemplate option allows the search box to display a string template with multiple fields based on user's input. In this particular example, we are searching based on a parcel owner's name.The resulting suggestions display the parcel id and address for the specified owner name.

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. Also, if using the Esri locator, suggest does not have an option to return a number of suggestions. The following property allows you to verify that a feature layer supports pagination.

featureLayer.advancedQueryCapabilities.supportsPagination === true


<!DOCTYPE html>
  <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>Search with Suggestion Template</title>
    <link rel="stylesheet" href="https://js.arcgis.com/3.21/dijit/themes/claro/claro.css">
    <link rel="stylesheet" href="https://js.arcgis.com/3.21/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="https://js.arcgis.com/3.21/"></script>

        "esri/map", "esri/dijit/Search", "esri/layers/FeatureLayer",  "esri/InfoTemplate", "dojo/domReady!"
      ], function (Map, Search, FeatureLayer,InfoTemplate) {
      var map = new Map("map", {
        basemap: "gray",
        center: [-82.93, 42.5], // lon, lat
        zoom: 10

      var search = new Search({
        sources: [{
          featureLayer: new FeatureLayer("https://services.arcgis.com/b6gLrKHqgkQb393u/arcgis/rest/services/TaxParcelQuery/FeatureServer/0", {
            outFields: ["*"],
            infoTemplate: new InfoTemplate("Parcels", "Owner name: ${OWNERNME1}</br>Parcel ID: ${PARCELID}</br>Site address: ${SITEADDRESS}")
          outFields: ["OWNERNME1","PARCELID","SITEADDRESS"],
          displayField: "OWNERNME1",
          suggestionTemplate: "${PARCELID}: ${SITEADDRESS}",
          name: "Parcels",
          placeholder: "example: Shawn Smith",
          enableSuggestions: true
        map: map
      }, "search");


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