I am currently developing 2 widgets in the Experience Builder. In one of the two widgets I have implemented the Esri search widget and mark the feature in the LayerView via the search result. Now I would like to use the other widget to react when a feature layer is selected and then read it.
Is this somehow possible I have already looked in the Map, View, Layer, LayerView to see if it is possible to read the currently selected features but so far I have not found anything.
The whole thing I had already managed via the popup but I would like to deactivate the popup.
Check out the documentation for the Search widget. There are some properties and events that get the selected result. The select-result event seems easiest:
const searchWidget = new Search();
searchWidget.on("select-result", function(event){
console.log("The selected search result: ", event);
});
Yes i allready have a simular line of code in Widget A and with the result of the search i highlight the features.
But now i want to get these highlighted features in my Widget B. There i dont have access to the search or is this also possible?
I also noticed that i have autoSelect set to false because i dont want the search widget to zoom on the result.
In this case the select-result event doesnt work.
You could either save the result from the select-result event to a global variable or call the selectedResult property from your other widget.