The search widget has a class, not a boolean property, for setting whether to show sources or not. I have a search widget with multiple sources.
I was assuming that the following would make "ESRI World Geocoder" entry name disappear from the dropdown when I start to type into the searchbox. What am I doing wrong?
.arcgisSearch .showSources { | |
visibility: hidden; |
}
showSources Class indicating whether to display sources.
thanks
Phil
Solved! Go to Solution.
Philip,
OK, I think I understand now. Add this css (important part is line 5):
.arcgisSearch .searchMenu .menuHeader { padding: 6px 12px; background: #4C4C4C none repeat scroll 0% 0%; color: #FFF; display: none; }
Phillip,
I think you are looking for the enableSourcesMenu property:
var s = new Search({ enableButtonMode: true, //this enables the search widget to display as a single button enableLabel: false, enableInfoWindow: true, showInfoWindowOnSelect: false, enableSourcesMenu: false, map: map }, "search");
I believe enableSourcesMenu may be what I want, but it doesn't seem to do anything for me.
To restate what I'm after. When I type into the search widget, I want to see suggestions in the dropdown as I type but I don't want to see the suggestion header.
So in this sample ( ArcGIS API for JavaScript Sandbox ) I don't want to see the "ESRI World Geocoder" and "Congressional Districts" titles. I do want their suggestions, just not the header/title.
Philip,
OK, I think I understand now. Add this css (important part is line 5):
.arcgisSearch .searchMenu .menuHeader { padding: 6px 12px; background: #4C4C4C none repeat scroll 0% 0%; color: #FFF; display: none; }
Bingo! Thanks
Do you want to keep the menu but not have the Esri World Geocoder be one of the search sources? If so you can do this by defining sources and passing in those sources to the Search constructor.
var sources = []; sources.push({ featureLayer: new FeatureLayer("http://services.arcgis.com/V6ZHFr6zdgNZuVG0/arcgis/rest/services/US_Senators/FeatureServer/0"), searchFields: ["Name"], displayField: "Name", exactMatch: false, name: "Senator", outFields: ["*"], placeholder: "Senator name", enableSuggestions: true }); var s = new Search({ sources: sources, map: map }, "search"); s.startup();
Hi Philip,
Here is a search sample that you can take a look to compare your code: