Brand new to Javascript and the ArcGIS API .... so please forgive me if this is a simple question ... but how can I pass a value of an address variable into the search widget of a mapview and have the search execute automatically?
Solved! Go to Solution.
As Robert points out via the provided link, you should call the 'search' method:
searchWidget = new Search({
view:view,
searchTerm: "1024 E 8th"
});
view.ui.add(searchWidget, "bottom-right");
view.when(()=>{
searchWidget.search();
});
John,
Just call the Search widgets search method:
https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search.html#search
searchWidget = new Search({ //add the search widget to the map view
view:view
});
view.ui.add(searchWidget, "bottom-right");
addy = searchWidget.searchTerm = "1024 E 8th";
searchWidget(addy);
the above code will not execute the search for me ... it populates the search field in the widget, just does not run the search and zoom to result
As Robert points out via the provided link, you should call the 'search' method:
searchWidget = new Search({
view:view,
searchTerm: "1024 E 8th"
});
view.ui.add(searchWidget, "bottom-right");
view.when(()=>{
searchWidget.search();
});
Yes!
Thank you all very much ...
view.when(()=>{
searchWidget.search();
});
The above bit of code did the trick!!