This content has been archived and is no longer being maintained.

Table of Contents

Article

Adding and deleting rows in an offline repeating dynamic layout

When creating a mobile application, you might want to provide application users with the ability to add or delete a row to a repeating dynamic layout while offline. To implement the add and delete row functionality, add a button, icon, or other UI control for the add and delete functions to the user interface. Then, the add row and delete row functions are called from the Pega API.

You can use one of the following techniques:

  • Inline – Both the Add button and repeating dynamic layout are in same section. Use the inline option if you plan to reuse the section.
  • Modal – The Add button is available in the modal dialog box. Use this option if your row edit is displayed in a modal dialog box.

To enable offline row addition and deletion, call the Pega API function AddRDLrow in the Actions tab of the repeating dynamic layout. Adding and deleting a row are separate actions and must be configured separately. The following steps are performed within a repeating dynamic layout.

Adding a row inline

  1. Add a control (button, icon, and so on) in a layout, and drop the layout below or above the repeating dynamic layout to control row addition.
  2. Open the Cell Properties of the control by clicking the Gear icon.
  3. On the Actions tab, click Create an action set.

Create an action set

  1. Under Action set 1, click Add an event and select the event that you want. In this example, the event is double-click.
  2. Click Add an action,and then click All Actions to view all available actions.
  3. Select the Run script action.
  4. Enter addRDLRow in the Function Name field.

Action set 1 dialog box

  1. In the Parameters section, enter the name of the property associated with the repeating dynamic layout as the first parameter.
  2. Click Submit to close and save the actions.

Adding a row from a modal dialog box

Adding a row from a modal dialog box requires two actions. You configure the repeating dynamic layout in a section. When the Add button is clicked, a local action launches. When the modal dialog box is submitted, a row is added to the repeating dynamic layout.

Add the event

  1. Add a control (button, icon, and so on) in the custom modal template configured in the launch local action.
  2. Open the Cell Properties of the control by clicking the Gear icon.
  3. On the Actions tab, click Create an action set.
  4. Under Action set 1, click Add an event and select the event that you want.

Add the first action

  1. Click Add an action, and then click All Actions to view all available actions.
  2. Select the Run script action.
  3. Enter doModalAction in the Function Name field.
  4. Enter script:pega.u.d.submitModalDlgParam for the first parameter value.
  5. Enter script:event for the second parameter value.

Add the second action

  1. Click Add an action, and then click All Actions to view all available actions.
  2. Select the Run script action.
  3. Enter addRDLRow in the Function Name field.
  4. In the Parameters section, the first parameter is the name of the property that is associated with the repeating dynamic layout.
  5. Click Submit to close and save the actions.

Cell properties actions

Deleting a row

The process for enabling row deletion is similar to adding a row.

  1. Within the UI element included in the repeating dynamic layout where you want to enable deleting, open the Cell Properties dialog box.
  2. Place the Remove button inside each repeating dynamic layout row that has the run script configured.
  3. In the Actions tab, create an action set and enter removeRDLRow as the function name.
  4. In the Parameters section, set the first parameter to script:event.

Cell Properties actions tab

Published April 27, 2015 — Updated February 19, 2016

Have a question? Get answers now.

Visit the Pega Support Community to ask questions, engage in discussions, and help others.