Template Repeater
Component Palette Icon:
The Template Repeater repeats instances of templates any number of times. It can arrange them vertically, horizontally, or in a "flow" layout, which can either be top-to-bottom or left-to-right. If there are too many to fit, a scrollbar will be shown. This makes it easy to quickly create screens that represent many similar pieces of equipment. It also can be used to create screens that are dynamic, and automatically configure themselves based on configuration stored in a database or tag structure. When first dropped on a window, the template repeater will look like any other empty container. To select the template to repeat, configure the repeater's Template Path property. There are two ways to set how many times the template should repeat:
-
Count - The template will be repeated X times, where X is the value of "Repeat Count". The repeat count starts at zero and increments X amount of times. Each value for X will be inserted into the custom property of the template that will be repeated. Template repeater inserts the value of X into the custom property on the template with the same name as the template repeater's "Index Property Name." For example, if the template has a custom property of "index" and the template repeater's Index Property Name is also "index," then the template will be repeated X many time with the value of X being inserted into the template's custom property called "index."
-
Dataset - The template will be repeated once for each row in the "Template Parameters" dataset. The template's custom properties with the same names as the dataset's column names will assume the values of each row of the dataset.
An Example of configuring the Template Repeater can be found on the Template Repeater Component page.
Name |
Description |
Property Type |
Scripting |
Category |
Background Color |
The background color of the component. |
Color |
.background |
Appearance |
Border |
The border surrounding this component. NOTE that the border is unaffected by rotation. |
Border |
.border |
Common |
Data Quality |
The data quality code for any tag bindings on this component. |
int |
.dataQuality |
Data |
Flow Alignment |
Alignment for "Flow" layout style. |
int |
.flowAlignment |
Appearance |
Flow Direction |
When the layout style is flow, this property controls if the components in the container flow horizontally or vertically. |
int |
.flowDirection |
Appearance |
Horizontal Gap |
The gap size to use for horizontal gaps. |
int |
.horizontalGap |
Appearance |
Index Parameter Name |
A name of an integer parameter on the template that will be set to an index number. |
String |
.indexParamName |
Behavior |
Layout Style |
Controls how the repeated template instances are laid out inside the repeater. |
int |
.layoutStyle |
Appearance |
Name |
The name of this component. |
String |
.name |
Common |
Repeat Behavior |
<p>"Count" will repeat the template a number of times, assigning each template an index number.</p></p>"Dataset" will repeat the template once per row in the template parameter's dataset.</p> |
int |
.repeatBehavior |
Behavior |
Repeat Count |
The template will be repeated this many times, if the repeat behavior is set to "Count" |
int |
.repeatCount |
Behavior |
Template Parameters |
This dataset will be used to control the number of templates and the parameters set on the templates if the repeat behavior is set to "Dataset" |
Dataset |
.templateParams |
Behavior |
Template Path |
The path to the template that this container will repeat. |
String |
.templatePath |
Behavior |
Vertical Gap |
The gap size to use for vertical gaps. |
int |
.verticalGap |
Appearance |
Visible |
If disabled, the component will be hidden. |
boolean |
.visible |
Common |
getLoadedTemplates()
-
Description
Returns a list of templates loaded into the Template Repeater. Properties on the components within each instance can be references by calling getComponent().
-
Parameters
None
-
Return
List of Templates
-
Scope
Client
This component does not have extension functions associated with it.
propertyChange
propertyChange
Fires whenever a bindable property of the source component changes. This works for standard and custom (dynamic) properties.
.source |
The component that fired this event |
.newValue |
The new value that this property changed to. |
.oldValue |
The value that this property was before it changed. Note that not all components include an accurate oldValue in their events. |
.propertyName |
The name of the property that changed. NOTE: remember to always filter out these events for the property that you are looking for! Components often have many properties that change. |
#This script will call getLoadedTemplates() on a Template Repeater, and
#then print the text property of a Label component in each instance
#Store a reference to the Template Repeater component in a variable
repeater
=
event.source.parent.getComponent(
'Template Repeater'
)
#Store the list of templates in another variable
templateList
=
repeater.getLoadedTemplates()
#Iterate through the list
for
template
in
templateList:
#find a component named "Label" in the instance,
#and print the value of the text property
print
template.getComponent(
'Label'
).text