A Dynamic Table's data- attributes
In HTML, a Dynamic Table is a normal <table> element with rows and cells (see HTML element: table). But apart from the native attributes of a table, rows and cells, it has some proprietary data-
attributes which make it dynamic.
These data-
attributes are set automatically on a new table that is made with the Dynamic Table Wizard that was introduced in version 2020.1.
They can be changed via the Attributes pane, depending on which element is selected (see Selecting an element), or directly in the template's HTML via the Source tab.
Tip: Just like other attributes, data-
attributes can be used as selector; see Using scripts in Dynamic Tables.
Note: When a Dynamic Table is filled with expressions instead of placeholders, no data-
attributes are added to cells. See Expressions or placeholders?
The table below lists the availabe data-
attributes.
Tip: A number of these attributes can be set in Design mode on the Attributes pane after selecting a table, row or cell (see Selecting an element).
Attribute | Element | Function |
---|---|---|
data-column-resize
|
<table> |
|
data-detail
|
<table> |
This attribute identifies a table as a Dynamic Table. It has no value. In tables made with an OL Connect version older than 2020.1, this attribute's value is the name of a detail table in the data. |
data-expander=
|
<table> |
Specifies that the table should be expanded using the expander that was introduced in OL Connect version 2020.1. Most of the |
data-field
|
Table cells and other HTML elements within repeating rows: <td>, <span>, etc. |
This attribute associates a data field with the element, e.g. By default this attribute is placed on cells. In order to mix data and text in a cell, move the Note: This attribute is not used when a Dynamic Table is filled with expressions. See Expressions or placeholders? |
data-format
|
<td> (a table cell) |
Defines how a value must be formatted; e.g. The available formats depend on the data type of the corresponding field in the Data Model (see Data types).
Note: This attribute is not used when a Dynamic Table is filled with expressions. See Expressions or placeholders? |
data-hide-when-empty
|
<table> |
Hide the table if it is empty. A table is considered empty if the detail record is empty. Note that any additional text is not taken into account. |
data-keep-when-empty
|
<tr> (a table row) |
Hide the row if it is empty. A row is considered empty if all elements with a |
data-repeat=
|
<tr> (a table row) in the body of the table (<tbody>) Note that this attribute is not supported for rows in the header or footer of a table (<thead>, <tfoot>). |
A row with this attribute is repeated for each record in the detail table that is specified in the attribute's value. Note: Empty records/data fields are skipped by default.
|
data-script
|
<tr> (a table row), <td> (a table cell), <span> |
When creating a script for a row, cell or span in a Dynamic Table this attribute is set on the element and used as selector (see Quick-start a script with the Create script button). Its value is the name of a data field; e.g. Note: This attribute is not used when a Dynamic Table is filled with expressions. See Expressions or placeholders? |
data-show-row
|
<tr> (a table row) |
When set on a row in the body of the table (<tbody>), this attribute causes a row (a line with data) to appear before and/or after a page break if a sub-table runs over multiple pages. Initially this attribute is omitted. A row without this attribute will be displayed once per record in a detail table. This attribute can be set to the following values:
On a row in the header (<thead>) or footer (<tfoot>) of the table, this attribute can also be set to the following value:
|
data-sum
|
<td> (a table cell) in the header or footer of a table |
Adds a running total (i.e. a subtotal) to a table cell after pagination. Its value consists of the path to a numeric field in a detail table, for example: |
data-breakable
|
<tr> (a table row) |
|
Differences in Dynamic Tables made with previous Connect versions
In Dynamic Tables made with Connect before version 2020.1:
-
There is no
data-expander
attribute on the <table> element. -
The
data-detail
attribute on the <table> element specifies the name of the detail table. (In tables made with Connect 2020.1 and up, this attribute has no value.) -
The
data-show-row
attribute can only have the value:all
. -
The
data-field
,data-format
,data-keep-when-empty
,data-script
anddata-sum
attributes cannot be used. -
The
data-showin
attribute determines the visibility of a header row or footer row if the table gets split over multiple pages. Its possible values areheader
,footer
andbreak
;break
may be combined withfooter
orheader
, for example:data-showin="footer, break"
, to make the row show up on every page.