<netui-data:repeater> Tag

Iterates over a data set to render it as HTML.

Syntax

<netui-data:repeater
    dataSource="dataSource"
    [defaultText="defaultText"]
    [ignoreNulls="ignoreNulls"] />

Description

Iterates over a data set to render it as HTML. The HTML is specified either directly within the the body of <netui-data:repeater> tag or within an associated set of "helper" tags. The "helper" tags are listed below.

TagDescription
<netui-data:repeaterHeader> Renders once at the start of the iteration.
<netui-data:repeaterItem> Renders once for each iteration.
<netui-data:repeaterFooter> Renders once at the end of the iteration.
<netui-data:pad> Used to convert irregular data sets into regular data sets through padding or truncating the output.

The <netui-data:repeater> tag can render in two modes; the first mode is a simple mode where the body of the <netui-data:repeater> tag is rendered once for each item in the data set. In this case, none of the other tags above are present in the repeater body. For example, the following will render the items in the "customers" data set as an unordered HTML list.

     <ul>
         <netui-data:repeater dataSource="{pageFlow.customers}">
             <li><netui:label value="{container.item.lastName}, {container.item.firstName}"/></li>
         </netui-data:repeater>
     </ul>

The second mode is a more structured mode of rendering where the "helper" tags are used to define the rendering of the data set. In this case, if one of the helper tags is present, any HTML markup directly in the body of the <netui-data:repeater> tag is not rendered; rather, the HTML markup inside the helper tags is rendered.

For example, the following will render the same output as the example shown above, but it uses the "helper" tags for rendering the HTML markup:

     <netui-data:repeater dataSource="{pageFlow.customers}">
         <netui-data:repeaterHeader>
             <ul>
         </netui-data:repeaterHeader>
         <netui-data:repeaterItem>
             <li><netui:label value="{container.item.lastName}, {container.item.firstName}"/></li>
         </netui-data:repeaterItem>
         <netui-data:repeaterFooter>
             </ul>
         </netui-data:repeaterFooter>
     </netui-data:repeater>

Attributes
dataSource
Required: Yes  |   Supports runtime evaluation: No  |   Data bindable:

defaultText
Required: No  |   Supports runtime evaluation: Yes  |   Data bindable: No

The text to render if the dataSource attribute references a null data set.
ignoreNulls
Required: No  |   Supports runtime evaluation: No  |   Data bindable: No

Boolean. If set to true, any null iteration items in the data set will be ignored.

 
Example

The following sample renders the data set as an HTML table. The table has two columns, "index" and "name", and each iteration over the data set is rendered as a row of the table.

    <netui-data:repeater dataSource="{pageFlow.myDataSet}">
        <netui-data:repeaterHeader>
            <table border="1">
                <tr>
                    <td><b>index</b></td>
                    <td><b>name</b></td>
                </tr>
        </netui-data:repeaterHeader>
        <netui-data:repeaterItem>
            <tr>
                <td>
                    <netui:label value="{container.index}" />
                </td>
                <td>
                    <netui:label value="{container.item}" />
                </td>
            </tr>
        </netui-data:repeaterItem>
        <netui-data:repeaterFooter>
            </table>
        </netui-data:repeaterFooter>
    </netui-data:repeater>