Dynamically adding rows to a repeater
In this tutorial, you'll learn how to dynamically add rows to repeater widgets using the Add Rows action.
1. Widget setup
-
Open a new RP file and open Page 1 on the canvas.
-
Drag a repeater widget, a text field widget, and a button widget onto the canvas.
-
Set the button's text to
Add New Row
.
2. Add a row to the repeater when the button is clicked
-
Select the button widget and click New interaction in the Interactions pane.
-
Select the Click or tap event in the list that appears, and then select the Add rows action.
-
Select the repeater widget in the Target dropdown.
-
Click the Add rows button. In the Add rows to repeater dialog that appears, click the fx icon to open the Edit value dialog.
-
At the bottom of the dialog, click Add local variable.
-
In the third field of the new local variable row, select the text field widget. This local variable will capture the text field's text in the web browser.
-
In the upper field of the dialog, enter the local variable's name in brackets:
[[LVAR1]]
-
Click OK to close the Edit value dialog and then click OK again to close the Add rows to repeater dialog.
-
Click OK in the Interactions pane to save the Add rows action.
3. Preview the interaction
-
Preview the page and enter some text in the text field.
-
Click the Add New Row button to add a new row to the repeater. The new row's rectangle widget should display the text from the text field.