smeijer / leaflet-geosearch

A geocoding/address-lookup library supporting various api providers.
https://smeijer.github.io/leaflet-geosearch/
MIT License
1.04k stars 273 forks source link

search provider is called a second time with the label of the selected item #184

Closed dirk-ecker closed 5 years ago

dirk-ecker commented 5 years ago

I use a specific search provider to search by name for organisations containing lat long in our database. The control shows me the results in a list using the label I gave him in the result struct of the search, so far so good.

Now, when I select an entry in the result it starts the search again - why - with the given label and returns the first entry of this result in the call to 'geosearch/showlocation' what gives me the wrong entry.

leafletControl.js:

if (autoComplete) {
      this.resultList = new _resultList2.default({
        handleClick: function handleClick(_ref2) {
          var result = _ref2.result;

          input.value = result.label;
          _this.onSubmit({ query: result.label, data: result });
        }
      });
dirk-ecker commented 5 years ago

Can be handled by the second parameter of the Provider.