AnsweredAssumed Answered

How can I specify multiple display fields in the search widget

Question asked by Jefairfi on Jun 27, 2017
Latest reply on Jul 5, 2017 by Jefairfi

In esri's 3.x or 4.x version, how can I search a feature layer by a field that has duplicate records?  For example, I want to search my feature layer with employers.  If I type "Mcdonalds", I get a list full of suggestions that all say "Mcdonalds" like this:

 

 

What I want to show in the suggestions is something like this:

 

Mcdonalds - address1

Mcdonalds - address2

Mcdonalds - address3

Mcdonalds - address4

 

Here is a section of my code for initializing the search widget.  I am specifying the "displayName" option: 

 

 

var sources = [{
   featureLayer: new FeatureLayer({ url: url, popupTemplate: popupTemplate }),
   searchFields: layer.search.searchFields,
   displayField: layer.search.displayField,
   name: layer.search.title || layer.title,
   outFields: layer.search.outFields,
   placeholder: layer.search.placeHolder
}]
var search = new Search({
viewModel: {
view: app.mapView,
maxSuggestions: 4
},
sources: sources
},'divID');

 

 

I am pretty sure there is no way in the api to do this.  Has anyone done this in their project or have any recommendations?

Outcomes