Handling the Click Event of Data Table Rows
In processes that contain a form with a data table, you can use the click action of a user on a data table row as a trigger event for user tasks and boundary events. This works similar to a button trigger event and causes the process flow to continue with the next step.
When you use a form with a data table, you can
Using the Click Action as a Trigger Event
Below you can see a form including a data table from the DataTable_ClickAction _Example. The data table shows different order items and some information about them:
When the user clicks on one of the items, a second form shows more details about it.
To use the click action as a trigger event, you have to assign the form with the data table to a user task. Select the click action on a data table row as a Trigger Event for the user task or a boundary event in the Attributes panel:
In the example, the trigger event table_OrderItems.rowClick is assigned to the user task Show_order.
If a user clicks on a data table row in the form, the process flow will continue to the next step.
In the example this is the next user task Show_item_details.
Reading the Last Clicked Data Table Element
When you create a form containing a data table, a class for the data table items is automatically created in the respective package Forms.<name of the form>.
This class has all the data table columns as attributes, as well as an attribute _meta: ItemMeta, which can store metadata about the data table item:
The class ItemMeta is provided in the folder PAS Form Elements:
Use Action Script to read the metadata stored for the items in a data table.
By reading the attribute _meta.lastClicked you can check if this data table item was last clicked by the user. You can use this information to extract the last clicked item and access it in the following process steps.
findLastClicked
local item = select first from formData.table_OrderItems where element._meta.lastClicked = true;
set clickedItem = if item.exists() then item else NULL;
In the example, the Action Script operation findLastClicked is used in the On Exit execution model of the user task to find the last clicked item of the data table table_OrderItems.
The item is then persisted and shown in a form.
DataTable_ClickAction_Example
Click here to download a simple example model that shows how you can use the clickAction trigger event for data tables in Scheer PAS Designer.
Related Pages: