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
- Section B contains Section A.
- 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.
- 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
Resolution
This issue is resolved by a local change by setting 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
Published January 31, 2016 - Updated October 8, 2020
Have a question? Get answers now.
Visit the Collaboration Center to ask questions, engage in discussions, share ideas, and help others.