Add Rows (Simple actions)

Dynamically adds rows to a data iterator.

Defined in

Extension Library

Type of simple action

Basic (Server)

Syntax

<xe:addRows rowCount="number" for="id" disableId="id" state="true|false" loaded="true|false"></xe:addRows>
Table 1. Attributes
Attribute Description
disableId="id" Identifies a control that is hidden if the iterator has no more rows. Typically this is the control that activates this action.
for="id" Identifies the iterator control. If this simple action is nested in a repeating control, that control is the default.
loaded="true|false" Creates a tag instance when the control is loaded, or not. Defaults to true.
rowCount="number" Number of rows to add. Defaults to the number of rows displayed on each page of the iterator.
state="true|false" If the server state should be saved after getting the AJAX request.

Examples

Here a button at the bottom of a data table adds three rows per click.
<xp:dataTable id="dataTable1" rows="10" value="#{javascript:return database.getAllDocuments()}" var="rowdoc">
	<xp:column id="column1">
		<xp:this.facets>
			<xp:label value="subject" id="label1" xp:key="header" style="font-weight:bold"></xp:label>
		</xp:this.facets>
		<xp:text escape="true" id="computedField1">
			<xp:this.value>
				<![CDATA[#{javascript:return rowdoc.getItemValueString("subject")}]]>
			</xp:this.value>
		</xp:text>
	</xp:column>
</xp:dataTable>

<xp:button value="Add 3 rows" id="button1">
	<xp:eventHandler event="onclick" submit="false">
		<xp:this.script>
			<xe:addRows rowCount="3" for="dataTable1" disableId="button1" state="true"></xe:addRows>
		</xp:this.script>
	</xp:eventHandler>
</xp:button>