Fire Data Provider Event
The Fire Data Provider Event action causes the DataProvider specified via the target
parameter to dispatch an oj.DataProvider
event as a way to notify all listeners registered on that DataProvider to react to changes to the underlying data. For example, a component using a particular ServiceDataProvider may need to render new data because new data has been added to the endpoint used by the ServiceDataProvider.
The action can be called either with a mutation or a refresh event. The refresh event is used to re-fetch and re-render all data, and the mutation event is used to specify which changes to show.
Note:
This action is not necessary for a VB Array Data Provider variable, since the data array of an ADP variable, exposed via thedata
property, can be updated directly using the Assign Variable action. Assigning the data array is automatically detected by Visual Builder, and all listeners are notified of this change. Users will be warned of this when the fireDataProviderEvent is used with an ADP, prior to mutating the data
property directly.
A mutation event can include multiple mutation operations (add, update, remove) as long as the ID values between operations do not intersect. This behavior is enforced by JET components. For example, you cannot add a record and remove it in the same event, because the order of operations cannot be guaranteed.
This table provides details about the parameters for the Fire Data Provider Event action. For further details, see DataProviderOperationEventDetail in Oracle JET API Reference.
Name | Type | Description |
---|---|---|
target | string | Target of the event, usually a variable of type vb/SDP.
Example: target: $variables.employeeSDP |
refresh | null | Indicates a data provider refresh event needs to be dispatched to the data provider identified by the target. A null value is specified because the refresh event does not require a payload.
Example:
For further details, see DataProviderRefreshEventDetail in Oracle JET API Reference. |
add | object | The following properties may be present in the payload:
|
remove | Only the keys parameter is required to identify the records. For details about the keys parameter, refer to the add event above.
Example: await Actions.fireDataProviderEvent(context, { target: $variables.employeeSDP, remove: { keys: [$variables.productId], }, }); For further details, see DataProviderMutationEventDetail in Oracle JET API Reference. |
|
update | The update event's payload is similar to that of the add event, except addBeforeKeys is not present.
Example: await Actions.fireDataProviderEvent(context, { target: $variables.employeeSDP, update: { data: {items: [callRestUpdateEmployeeResult.body]}, keys: [callRestCreateEmployeeResult.body.id], metadata: [{key: callRestCreateEmployeeResult.body.id,}], }, }); For further details, see DataProviderMutationEventDetail in Oracle JET API Reference. |