Table of Contents

Article

Cascading drop-down controls for offline Pega 7 Platform applications

The Pega 7 Platform now supports cascading list-based controls in offline applications. The cascading is achieved by triggering a custom JavaScript function on a list-based control, such as a drop-down menu, with a data page as its source in the offline application.

Cascading is supported only for drop-down, list-based controls.

The data pages need to be packaged before they can be used as a source for list-based controls. By default, all the data pages that are referenced in the application, such as harness, section, flow action, and local action, are packaged automatically. The non-referenced data pages must be listed in the pyDataPageWhitelistForOffline HTML rule for packaging.

Parameterized data pages package only metadata and not the actual data.

To populate the actual data for list-based controls that are sourced from parameterized data pages, you need to use a custom JavaScript function with the same name as the data page. Use the Formatted text control for the declarative target property to trigger the registered function before displaying it.

The following example shows a custom JavaScript function, Declare_LoadEmployees, for cascading a drop-down menu from a data page.

function Declare_LoadEmployees(dpPage, params){<br />
    var cc=pega.u.ClientCache;<br />
    var employeesInSiteServicesPL = dpPage.put("pxResults",[]);<br />
    var employeePLIter = cc.find("Declare_LoadAllEmployees.pxResults").iterator();<br />
    while(employeePLIter.hasNext()){<br />
      var empPg = employeePLIter.next();<br />
      var role = params.pyRole;<br />
      if(empPg.get("pyRole").getValue()== role){<br />
         employeesInSiteServicesPL.add().adoptJSON(empPg.getJSON());<br />
      }<br />
    }<br />
}

This feature helps to cascade the drop-down menu list based on the value that is selected in the original drop-down list. For example, the values for a drop-down menu for States can be listed based on the value selected from the drop-down menu for Country.

Published July 23, 2015 — Updated September 1, 2015

Have a question? Get answers now.

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