2

I'm using the following searchWidget and it works fine, I need to know how can I get location details, once I type something and hit enter. Lets I search for New York and hit enter, then search data should be taken into a variable (search value, location details, etc).

  var searchWidget = new Search({
        sources:[{
          countryCode:"LKR",
          placeholder: "Search",
        }],
        view: this.view,
        includeDefaultSources: false,
        container : document.createElement("div")
      });

1 Answer 1

2

You have to connect to the search-complete event from the search widget, if you wanna use all the results given by the search; or the select-result, if you wanna use only the selected result.

var searchWidget = new Search({...});

searchWidget.on("select-result", function(event) {
  console.log("The selected search result: ", event);
});

You can find more information about the object returned by the event in the official documentation

2
  • 1
    Thank you very much, this is what i wanted Commented Oct 11, 2019 at 17:22
  • 1
    @SharePointLearner then please mark the answer as correct ;)
    – Katah
    Commented Oct 15, 2019 at 6:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.