I'd like my search widget to display suggested results, as it does in the basic search example. However, I want to customize the "sources" to only return search results in my area of interest (10 counties in East Tn). Setting the searchExtent property is effectively limiting search results to my area. But adding these customizations to the sources seems to break the suggestions. My codes is below.
As a side note, the highlightSympbol doesn't seem to work either. The default blue icon is very similar to some of the point features in my map. Any idea why it's not working as well?
I've intentionally left all of the lines that I have commented out to show the different settings/properties that I've tried.
Thanks!
var map = new Map("map", {
basemap: "gray",
center: [-83.942, 35.9728],
zoom: 9
});
var s = new Search({
map: map,
zoomScale: 24000,
enableSuggestions: true
}, "search");
windowResized();
//add the home button
var home = new HomeButton({
map: map
}, "HomeButton");
home.startup();
var sources = [];
sources.push({
locator: new Locator("//geocode.arcgis.com/arcgis/rest/services/World/GeocodeServer"),
singleLineFieldName: "SingleLine",
countryCode: "US",
searchExtent: new Extent(
{
xmin: -9433102.5652,
ymin: 4232556.948,
xmax: -9233957.949,
ymax: 4356720.4646,
spatialReference: {
wkid: 102100
}
}),
outFields: ["Match_addr", "PlaceName"],
//outFields: ["address", "PlaceName"],
//outFields: ["*"],
//name: "World Geocode Service",
enableSuggestions: true,
enableSuggestionsMenu: true,
maxSuggestions: 5,
suggestionDelay: 100,
minCharacters: 0,
placeholder: "Enter an address or place",
highlightSymbol: new PictureMarkerSymbol('https://cdn0.iconfinder.com/data/icons/20-flat-icons/128/location-pointer.png', 26, 33).setOffset(1, 1)
});
s.set("sources", sources);
//highlight symbol
//var searchSymbol = new PictureMarkerSymbol("http://i.stack.imgur.com/cdiAE.png", 20, 20);
//s.sources[0].highlightSymbol = searchSymbol;
s.enableSuggestions = true;
s.startup();