Act as For Actions

In the ViewModel Editor, the property "Act As For Actions" helps you in the following ways:

  • If you have a grid with objects of type B, but many of the actions you want to expose on these objects reside in class A, enter an expression in the "Act As For Actions" that navigates from type B to type A (the expression must end up in 1 or 0 objects). This saves you the trouble of creating new class actions on B that repeat the logic for the class actions on A. This will make your B's act as A's when deciding what actions to expose.

This scenario is common for association objects (multi-link between A and C with a link to class B in between).

You want the precision B offers in the grid but with the actions of A also available. In this case, the context is B, and the expression would be self.A.

Example

2024-07-17 05h06 45.png

Category class may have actions that would like to access within the Sale class or ProductSale class ViewModels.

For this example, the ShowCategory class action on Category ViewModel can be accessed within the ProductSale actions using the Act As For Actions property.

Within the Product Sale Nested ViewModel, set Act As For Actions to point to Category object from ProductSale object.

With this, Category actions will be available and accessible from the ProductSale actions context.

Act As For Actions example
This page was edited 128 days ago on 07/18/2024. What links here