Applies to Pega Platform 7.2-8.5
Sections are the building blocks of your user interface. You can populate a section with user interface elements, such as fields and controls, to build a modular user interface that promotes reusability and design consistency.
You can include or embed a section inside another section, a layout or a cell in a layout. For example, the repeating dynamic layout (RDL) saves application development time by automating the display of repetitive data records. RDL supports sorting, editable fields, and progressive data load. You can also add an action to an included section. This article describes how embedded sections work and captures the commonly reported questions and issues.
The following figure helps depict two commonly reported issues related to embedded sections. The figure contains three types of sections:
- Section A is embedded in two primary sections of the application. Section A is autogenerated. It is editable if its parent section is editable, otherwise it is read-only.
- Section B is read-only.
- Section C is editable.
Refresh-Other Section action changes a read-only section to an editable section.
A section is included twice in a single harness: once as an editable section, the other time as a read-only section. One of the actions in the editable section is Refresh-Other Section that refreshes the included section (same section which is included twice). After refresh, the read-only section turns editable.
However, on that same Refresh-Other Section action, Section A embedded in Section B, which is read-only, turns editable, even though its parent section (Section B) is read-only.
Solution: Local change
Specify a control to selectively refresh only the parent section instead of refreshing an embedded, child section. In the example shown in the figure, specify a control in Section C to refresh only Section C (the parent section) instead of refreshing Section A (the embedded section).
A section containing a Repeating Dynamic Layout (RDL) is embedded in a read-only section.
When a Delete Item action is invoked on an RDL field, the section refreshes and turns editable. However, since the section is embedded in a read-only section, it must persist as read-only.
Pega-provided actions such as Delete Item and Refresh row cause implicit refreshing (reloading) of sections.
In the example figure, if Section A contains a Repeating Dynamic Layout (RDL) with a button for a row of the RDL, on click of the button triggers the Delete Item action on the RDL row. The Delete Item action implicitly causes Reload Section on Section A, making Section A editable, even though it is embedded in read-only Section B.
Solution: Local change
Add a non-auto-generated section (Section D extending the example of the figure) as a wrapper for Section A. Include Section D inside Section B. In the HTML fragment of Section D, add the following code:
String existingROFlag = tools.getParamValue("SectionReadOnly");
/* OverRide ROFlag as readonly always */
/* Reset RO flag to previous state*/