Select to view content in your preferred language

Hello How can I get the entered text value with searchWidget?

580
3
05-20-2024 04:50 AM
emreaktas1
Regular Contributor

Hello
How can I get the entered text value with searchWidget?

emreaktas1_0-1716205163107.png

 

 

// js code

emreaktas1_1-1716205755010.png

 

0 Kudos
3 Replies
ReneRubalcava
Honored Contributor

You can check the searchTerm property

https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search.html#searchTerm

It just depends on what event you want to check it

https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search.html#events-summar...

 

searchWidget.on("suggest-start", () => {
  console.log("term: ", searchWidget.searchTerm);
});

searchWidget.on("suggest-complete", () => {
  console.log("term: ", searchWidget.searchTerm);
});
emreaktas1
Regular Contributor

emreaktas1_0-1716273979544.png

I want to show all my values ​​in the search result in a container. How can I show this?

Can I get the returned values ​​with the following code?

layerParsel.queryFeatures(query).then(function(featureSet) {
    featureSet.features.forEach(function(result) {
 //do something

 

0 Kudos
emreaktas1
Regular Contributor

How can I show search results in a container?

// js code

emreaktas1_0-1716278371731.png

 

 

0 Kudos