Add action triggers to widgets
You can do the following to create dynamic and interactive apps with Experience Builder:
- Connect widgets with data and configure them with dynamic content.
- Configure interactions between a widget and the framework (data source).
- Configure interactions between widgets.
Experience Builder apps are data-driven, which means that the data displayed by widgets can change universally when the underlying data updates. You can define interactions between a widget and the data by configuring the actions in response to triggers. For example, you can create an interaction that whenever the Map widget changes its extent, the other widgets such as List will get filtered and display only features within the current extent, by setting the extent change in Map widget as a trigger and the filter record in the data view that List is using as an action. Because the widgets are data-driven, the filter action is applied at the framework and data level so every widget using the same data view will be synced automatically. You can also define interactions between widgets. Actions provided by a widget will only take effect within itself. For example, you can synchronize the extent of two Map widgets when users zoom or pan one of them by setting the extent change of one Map widget as a trigger and change extent of the other Map widget as an action.
Interactions are defined and managed in the Action pane of the source widget that provides the triggers. Interactions have three parts:
- Triggers from the source widget
- Targets that respond to the trigger, including widgets and the app framework
- Actions from the target related to its intended use
The source widget’s trigger can only be added once; however, you can add multiple actions for that specific trigger from the same or a different target.
Triggers are events generated by the source widget. Once a trigger occurs, any actions added to it are executed in response. The following table describes the two triggers that are currently supported:
A trigger occurs when the map’s extent changes via panning, zooming, resizing, and so on.
Record Selection Changes
A trigger occurs when a record is selected or a selected record is cleared.
To view a widget’s available triggers, open its settings and click Add a trigger on the Action tab. The following table lists source widgets and their supported triggers:
Record Selection Changes
Targets perform the actions. A target can be a widget or the framework. If you choose the framework as the target, the action is performed globally—throughout all relevant widgets and pages in the app.
Unlike the triggers that are defined by the framework, actions are provided by targets (especially widgets) to perform specific business logic. Some actions may need additional configuration depending on how the target handles the message from the trigger. For example, if you’re configuring a filter action for a data view and the trigger is based on different data, you can filter the target data view by establishing an attribute or spatial relationship. You can also set SQL conditions.
Different targets provide different actions that correspond to different triggers. Available actions appear once you add a trigger and select the target. The following table lists targets and their corresponding actions:
Trigger: Record Selection Changes
Trigger: Extent Changes
Filter Data Records—Keep only the records in the data view that meet the conditions for further display or processing through the app.
Select Data Records**—Mark the records as selected and put it into the Selected features view.
Pan to—Keep the current scale and center on a specified location.
Zoom to—Zoom to a specified location.
Flash—Flash a feature on the map.
Filter—Keep only the features that meet the conditions for viewing in the map widget.
*For framework actions, if the action data is the default view, the action will affect all widgets using the data and its views. If the action data is a specified view, the action will only affect the widgets using that view. For widget actions, the action will only perform on the target widget. (For example, the map filter action will only filter the records in the map and won’t affect all other widgets using the same layer.)
**The selected state of a record is synchronized throughout the app and the selected records are saved in the data’s Selected features view. Widgets may have a different configuration for displaying a selected record.
Configure interactions on the Action tab of the source widgets (widgets that provide triggers). Add and select the trigger, select the target, and add and select the actions. Each trigger can only be added once, but you can add multiple actions for the same trigger by clicking Add action. Actions for the same trigger occur in sequential order. Drag the actions grouped under a trigger to change the order.
Some actions, such as Filter, Flash, and Select Data Records, require additional configuration. The Action settings options appear when you select the action. Once configured, you can modify the settings later by clicking the action’s Setting button . To change an action or target after adding an action, you must delete it and add a new one. Deleting a trigger also deletes all the actions added to it.
Add action triggers to support app design requirements such as the following:
- You want to build an app that compares two maps, two scenes, or a map and a scene, so the extents of the two Map widgets should always be synchronized. You can add an Extent Changes trigger to both widgets, select the other widget as the target for each, and choose the Pan to or Zoom to action.
- You add a List widget next to a Map widget and you want the list to only display the records within the map’s current extent. You can add an Extent Changes trigger to the Map widget, select the Framework’s Filter Data Records action, choose the action data as the data view configured in List settings, and configure the action with a spatial relationship to the extent.