I have a hierarchical table built using Legacy Markup that includes drag-and-drop functionality. Whenever the user performs an incorrect action, I need to refresh the list so that it reverts to its original state.
Currently, the menu only supports actions such as “onClick,” “onDoubleClick,” and keyboard actions. However, I require an “onChange” action to handle this scenario. Could you please advise on how to implement the “onChange” action?
After an investigation done from ourside, the above can be accomplished as follows:
- Embed the hierarchical table in a dynamic layout
- Configure the layout to refresh whenever a specific property changes (BooleanVal1)
- Take a backup of the Page referenced in the hierarchical table using the activity pyPreGridUpdate
- Reverting the page to its original state using the activity pyPostGridUpdate
- Change the property value (BooleanVal1) in the next step of the pyPostGridUpdate
- This will trigger a refresh on the layout and will revert the hierarchical table to its original state
@JosephAzar thank you so much for having shared the solution.
In case other users are interested find out a solution to trigger a toast message for the user action whenever needed, below was the explanation on the limitations provided by our support engineer:
"The Cosmos design system includes a toast component (see Cosmos Toast) that is used to display short messages to confirm a completed user action (such as a form submission). Toasts inform users that an action happened if users cannot see the action on screen.
However, this component is not fully available in Theme-Cosmos and is only available in the Cosmos React implementation. In Theme-Cosmos, a toast is displayed only when creating a new case and if the newly created case is not immediately opened after clicking on the create button. This behavior can be configured in the Cosmos UI settings for each case type.
There is a detailed guide on the support center with additional JavaScript codes and a video titled “How to generate a toast when processing assignment in Theme Cosmos.” This guide also explains how to use it after a local action is called. You could use the runscript after the local action is called and directly call the function pega.utility.toast.show. The trick is to determine if the local action was successful. The best way is to set a property in the post activity of the flow action to success/fail and ensure that this property is present in the section using a hidden input. Once the local action is completed, the value of the property should be updated with the status. You can then use a condition expression on the runscript to determine if this action should be executed or not".
Please check this guide: