I'm wondering if anyone has managed to use the search widget with autoSelect set to false? I would like the user to type in the search box something like "medium", and hit enter, and have all features with "medium" in the search field returned. All of my layers feeding into the search widget work fine when autoSelect is set to true, but as soon as I set it to false it seems the widget is unable to select anything at all. Either by hitting enter, or by clicking one of the suggestions in the dropdown - nothing happens at all. No infoWindow shows and the map doesn't zoom to any features. Am I missing something? Do I need to do something in addition to just setting autoSelect to false?
Solved! Go to Solution.
Hello Laura,
I think it works as expected. As per the documentation for autoSelect
Indicates whether to automatically select the first geocoded result. If
false
, the findAddressCandidates operation will still geocode the input string, but the top result will not be selected. To work with the geocoded results, you can set up a search-results event handler and get the results through the event object.
It means that it select the first result graphic and zooms and pops up the infowindow when autoSelect is true. else you need the handle the results your self. i.e. create your own popup or use map.infowindow and set the features to it using the setFeatures method.
Hope this was helpful.
Jsfiddle here. If you type a partial address and hit enter (ie. type "2980 Prin" then hit enter) you can see multiple results are being returned. Results are also logged to the console. Should I be handling the results myself, or is this a bug that the infoWindow is not popping up and no results are zoomed to?
Hello Laura,
I think it works as expected. As per the documentation for autoSelect
Indicates whether to automatically select the first geocoded result. If
false
, the findAddressCandidates operation will still geocode the input string, but the top result will not be selected. To work with the geocoded results, you can set up a search-results event handler and get the results through the event object.
It means that it select the first result graphic and zooms and pops up the infowindow when autoSelect is true. else you need the handle the results your self. i.e. create your own popup or use map.infowindow and set the features to it using the setFeatures method.
Hope this was helpful.
Thanks Thejus. I found the documentation a bit ambiguous but if that's the expected behaviour, I can work with that.