To provide an improved user experience, it is possible to configure actions so that they appear only when they are available, according to the selection performed in a grid. The "Show Action Only If Available" property was created to acheive this.
The "Show Action Only If Available" property is applicable to all the actions associated with a grid. The actions associated with a grid are those that act on a subset of its elements, except for those included as grid columns (actions in grid).
In a K2BTools instance, these actions have the “Row Selection” property set to “Single” or “Multiple”.
The property “Show Action Only If Available” allows determining whether the action must be shown in all cases or only when the selection performed in the grid by the end user matches the type of action.
Let's suppose that the following structure exists for the actions of a belonging to a Grid (WPD) node or a WorkWith node. The actions are presented with their value in the property “Show Action Only If Available”.
|Show actions only if available example structure
At runtime, the result will be as follows:
|Show actions only if available example runtime behaviour
1. This behavior may be disabled in each individual action or globally using the property “Show Actions Only If Available” in the general configuration of K2BTools patterns. If the global property is changed, the properties' default value is changed in all actions. Therefore, if actions exist whose property value has been changed manually, the value will be kept for this action.
2. From the Web Panel Designer, this behavior can be disabled globally using the property with the same name included in the tool's configuration.
3. K2BTools generates defensive checks when running the event associated with the action to confirm whether the number of elements selected is allowed for the action. Therefore, the developer can assume that the selection is correct when determining the action's behavior.
4. As a result of the second item, if the pattern is told that an action must be always visible, and the end user runs the action with a non valid selection of elements for it, the corresponding error message is displayed according to the properties “Error Not Selected Lines” and “Error Message”.
5. This feature is combined with the security check per action: the actions displayed are those valid for the selection and enabled for the user.
6. This feature is applicable to the following actions:
a. In Patterns: Actions within Work With and Sub Work With objects whose Layout is different than “InGrid”, and have “Row Selection” set to “Single” or “Multiple”.
b. In Web Panel Designer: Actions within Action nodes which are children of Grid nodes, with “Row Selection” set to “Single” or “Multiple”.
IMPORTANT: Action nodes included in Columns or Free Style Sections don't have this property associated with them.