Skip to main content

This content has been archived and is no longer being updated. Links may not function; however, this content may be relevant to outdated versions of the product.

Support Article

"Expand when" condition for grid not triggered upon refresh

SA-3086

Summary



A section has a repeat grid configured with collapsible headers. An "expand when" condition is also defined on the headers. This section is placed in another section (parent section). It is observed that the "expand when" condition is not triggered when parent section is refreshed. Using an expression in place of  the "when" condition also does not help. In this example use case, if a row of the grid is clicked, the grid should change to the collapsed state.

Error Messages



N/A


Steps to Reproduce

  1. Section B contains Section A.
  2. Section A contains a repeat grid with collapsible headers and expand when condition. Under 'Actions' tab of the grid properties dialog, the onclick event has 2 actions. First, it runs an activity and then it refreshes the parent section (Section B) that contains the repeat grid section. The activity sets properties on the clipboard, which in turn affects the "expand when" condition.
  3. At run time, when row of the grid is clicked, the parent section is refreshed. However, the grid remains as expanded. As per the condition in when rule, it should have collapsed. Checking the tracer shows that the when rule was never executed.

Root Cause



The reported behavior is actually working as designed.

"Expand when" configuration honors the state of layout at design time and executes the when rule only during initial load. But once the layout is expanded manually or through a server side when condition, it remains in an expanded state for further AJAX requests. It is designed this way to always honor the user preference ahead of the expand when. There may be use cases where the user expands the layout manually and expects the layout to remain expanded, irrespective of whether the when condition is true / false. Also developers need to keep in mind that this is an expand when condition and not collapse when condition.

"Expand when" is controlled by a hidden input field with name ExpandedSubSectionXXYY (where XX - section name and YY - layout id).

On Initial load,
  • If expand when condition is true - layout will be expanded and hidden input field will be set to true
  • If expand when condition is false - design time setting will be honored and input field will be set to blank
Since upon initial load, the hidden parameter was set to 'true' and it was never set to false explicitly, the grid always remained expanded on section refresh.

Resolution



This issue is resolved by a local change by s
etting the hidden input field parameter to 'false' in the activity step. The value of this hidden input field can be set to:
  • False -> will collapse the layout
  • True -> will expand the layout
  • Blank("") -> will execute the evaluate when rule
In this case, the parameter was set to 'false' to achieve the behavior of collapsing the header onclick of the grid.

Published January 31, 2016 - Updated October 8, 2020

Was this useful?

40% found this useful

Have a question? Get answers now.

Visit the Collaboration Center to ask questions, engage in discussions, share ideas, and help others.

Did you find this content helpful?

Want to help us improve this content?

We'd prefer it if you saw us at our best.

Pega Community has detected you are using a browser which may prevent you from experiencing the site as intended. To improve your experience, please update your browser.

Close Deprecation Notice
Contact us