When a user enter a search for a particular record, can the result return display multiple field. We have a few duplicate valveID. Instead of returning v-155 three time can I config. the search result to display valveID and system field?
In C:\arcgis-web-appbuilder-2.1\server\apps\9\configs\Search\config_Search.json, I tried to change the displatField but the search did not work. Is this possible?
Solved! Go to Solution.
My mapserver source for searching look like this.
http://pabry280/arcgis/rest/services/AquaGISServices/AquaGIS_Search2/MapServer/1
Ha,
So after checking the search widgets code in WAB the suggestionTemplate is not used in the code. It get it working you will have to add these lines of code to the search/Widget.js file (lines 16 - 19):
var convertedSource = {
featureLayer: flayer,
outFields: ["*"],
searchFields: fNames,
displayField: source.displayField || "",
exactMatch: !!source.exactMatch,
name: jimuUtils.stripHTML(source.name || ""),
placeholder: jimuUtils.stripHTML(source.placeholder || ""),
maxSuggestions: source.maxSuggestions || 6,
maxResults: source.maxResults || 6,
zoomScale: source.zoomScale || 50000,
infoTemplate: template,
useMapExtent: !!source.searchInCurrentMapExtent,
_featureLayerId: source.layerId,
};
if(source.suggestionTemplate){
delete convertedSource.displayField;
convertedSource.suggestionTemplate = source.suggestionTemplate;
}
You are the man. See Robert, I new that there was something missing and not just adding a suggestionTemplate property. It works great. Thanks you for your time and bearing with me in trying to explain my issue.
To those who wanted to do this.
Recap of what I did base on Robert suggestion.
Add code to widget.js and config_Search.json. See below.....
Thanks,
Ha Thach
Hello Robert,
I want to show on display field different result for example this units at what sector belongs so, display two results. I need to use web app builder developer right, this is not out of the box option. ?
Regards,
DLL
Robert - I got the suggestionTemplatet to work but despite setting it to exact match, the search executes a LIKE search. Is there a way to fix this?
Ha Thach,
Having suggestion enabled if you want to use exact match is counter productive. The whole purpose of suggestions is to provide possible result using a like if you do not want this then disable suggestions. What the exact match does is it will force you to choose one of the suggestions to get a result if you did not have exact match selected and you type 862 and hit enter then the first result that matched 862 would be selected.
Thanks, Robert for your input. The simple solution on my end would be to increase the "maxSuggestions" result value.