Select to view content in your preferred language

How to change suggestion of suggestionsEnabled property?

135
1
Jump to solution
01-13-2025 01:14 PM
JaredPilbeam2
MVP Alum

In this (hopefully) reproducible example, my search field is "Region". The search shows values of the first field of the table, that being "Sitename L". Is there a way to change the suggestion?

let searchWidget = new Search({
  view: view,
  maxSuggestions: 6,
  sources: [
    {
      layer: fish,
      searchFields: ["Region"],
      name: "fish",
      zoomScale: 500000,
      maxSuggestions: 6,
      suggestionsEnabled: true,
    }
  ]
});

 

Search:

JaredPilbeam2_1-1736802824700.png

 

Table:

JaredPilbeam2_0-1736802790854.png

 

0 Kudos
1 Solution

Accepted Solutions
JoelBennett
MVP Regular Contributor

Yes, you can accomplish this by assigning a value to the suggestionTemplate property.  You'll also want to set the outFields property to ensure that values for any fields you use in the template are being returned.

View solution in original post

0 Kudos
1 Reply
JoelBennett
MVP Regular Contributor

Yes, you can accomplish this by assigning a value to the suggestionTemplate property.  You'll also want to set the outFields property to ensure that values for any fields you use in the template are being returned.

0 Kudos