Event payload
Information on event payloads -- in one place.
Last updated
Information on event payloads -- in one place.
Last updated
An event payload contains information useful for distributing an event. This often includes data conveyed by the event that can be used to define the action parameters.
Each interaction contains an event payload, which varies depending on the element and the event.
For example, suppose you'd like to click on a table row and set a text element to display the id
of the row that's been clicked. The data for the clicked table row will be stored in the event payload, which you will be able to access with ${event.rowData.id}
to get the row's id
to set your text element.
For each interaction, you can view the name and format of the data in the event payload by clicking on the button. All the event payloads are stored in the event
key, while the prev
key allows you to access the output from the previous action.
In this example, an interaction has been set up on a table. When it is clicked, its event payload will include an object called rowData
containing data for that row, as well as rowKey
and rowIndex
.
Accessors are used to obtain data from event payloads to use in an interaction. Accessing data in the event payload differs whether you're in the configuration panel or the transformer.
The configuration panel provides input boxes for each action parameter, mapping your input to its respective parameter. You'll be able to access the event payload with ${event.xx}
.
To switch mode to transformer, click on the f(x)
symbol next to "Action Parameters". This will bring you to the transformer code editor. In this code editor, you'll be able to use JavaScript to further calculate and transform your data before setting your parameters. In the transformer, you can access the payload with payload.event.xx
.
The parameters
variable is an object with a name:value pair for each parameter. This object will contain the final values to return.
Event payloads for interactions on a data node also contains an object, mountData
, which contains a key called data
that contains your node's data. The data is stored as an array of JSON objects, each object representing a row with key:value pairs for each column.
For example, if my data node has 2 rows, mountData.data
will contain an array with 2 JSON objects:
Since the data for a data node is not stored in the event
object, the accessor looks slightly different.
In the configuration panel: ${mountData.data}
In the transformer: payload.mountData.data