2020.1

Table Of Contents
The scope of the script is set to Each matched element (see "Setting the scope of a script" on
page849). This means that in the code, this refers to the element that matches the selector,
and this.record refers to the current (nested) detail record (see "this" on page1317).
Tip
To get access to the row in which the cell is located, you can use this.parent().
Note
If you bind the element to a data field again (by selecting it and then selecting a field from the Field
drop-down on the Attributes pane), the data-script attribute will be removed.
Writing scripts for a Dynamic Table
If you're going to create your own scripts for Dynamic Tables, there are a few things you need to
know.
Selectors
Scripts that target (an element in) a Dynamic Table can use the same types of selectors as
other scripts. In the output, Dynamic Table rows are repeated including any classes that are set
on the row and on its contents.
In addition, Dynamic Tables and their rows and cells have some special data- attributes that
can be used as selector. See: "A Dynamic Table's data- attributes" on page807.
Note however, that the data-repeat attribute cannot be used as a selector for template scripts,
since it gets removed when the table is expanded, which happens before template scripts run.
The data-script attribute is used if you let the Designer create a script for you (see "Quick-start
a script with the Create script button" on the previous page).
How the scope of a script can simplify code
It is recommended to set the scope of a script that targets (an element in) dynamically added
rows to Each matched element.
Page 877