Hello,
I am new to ExB and React. I am trying to create a warning widget that appears only when a specific data is in the extent of the Map widget/view.
I have figured that I can use Action Trigger in the Map widget to be set on Extent Change and this should apply a Filter on the data source that is accessible to all widgets.
But can I hide a widget from view when no features of the configured data source is in the extent? I see WidgetState only applies to a widget in the Widget Controller. But I don't want it to be in the controller, I just want a message popup and dissapear if no data is visible.
I have so far reverse engineered Text Widget to make my message but I cannot figure out how to hide/unhide it based on the data action.
Sorry if it sounds totally wrong, maybe I am not understanding it properly.
Regards,
Serj
Solved! Go to Solution.
To follow up on this idea. I ended up adding JimuMapViewComponent and using watchUtils from 'esri/core/watchUtils' to monitor change in map extent via activeViewChangeHandler function and set mapExtent in useState react hook. I then created a useEffect() react hook that executes whenever the mapExtent useState hook state changes, with an async function inside to query the total count of features in the connected data source.
Okay I think I figured out how to hide the widget component if variable dataInExtent is false and we are not in the builder environment, basically just return null so nothing gets rendered:
dataInExtent = false
Now need to figure out how to get the TotalCount of features in the Data Source? I think there is a property somewhere I saw in the API. Since Map widget applies a map extent trigger and filters the data, this should come across?
To follow up on this idea. I ended up adding JimuMapViewComponent and using watchUtils from 'esri/core/watchUtils' to monitor change in map extent via activeViewChangeHandler function and set mapExtent in useState react hook. I then created a useEffect() react hook that executes whenever the mapExtent useState hook state changes, with an async function inside to query the total count of features in the connected data source.
Dears,
I have different zones of areas and I have one custom widget which is made particularly for one specific zone I want my user to open my widget using a button but I want that button to be shown only when map extent is on that particular zone. Please suggest some solution.