Customization of an Action
public class BaseBLC : PXGraph<BaseBLC, DAC>
{
public PXSelect<DAC> Objects;
public PXAction<DAC> ValidateObjects;
[PXButton]
[PXUIField(DisplayName = "Validate Objects")]
protected virtual void validateObjects()
{
}
}
You can alter actions within BLC extensions in the following ways:
- By overriding action attributes within a BLC extension.To override action attributes in a BLC extension, you should declare both the BLC member of the PXAction type and the delegate. You should attach a new set of attributes to the action delegate. Also, you need to invoke the Press method on the base BLC action. Having redeclared the member of
PXAction<>
, you prevent the action delegate execution from an infinite loop. Consider the following example of a first-level BLC extension.public class BaseBLCExt : PXGraphExtension<BaseBLC> { public PXAction<DAC> ValidateObjects; [PXButton] [PXUIField(DisplayName = "Validate All Objects")] protected void validateObjects() { Base.ValidateObjects.Press(); } }
The Actions collection of a BLC instance contains the ValidateObjects action, which consists of the
PXAction
type member and the delegate, both of which were declared within the first-level extension (see the following figure).Note: When overriding an action delegate within a BLC extension, you completely redeclare the attributes attached to the action. Every action delegate must have PXButtonAttribute (or the derived attribute) and PXUIFieldAttribute attached. - By overriding the action delegate within the BLC extension. The new delegate is used by the appropriate action. Consider the following example of a second-level BLC extension.
public class BaseBLCExtOnExt : PXGraphExtension<BaseBLCExt, BaseBLC> { [PXButton] [PXUIField(DisplayName = "Validate Objects")] protected void validateObjects() { } }
The Actions collection of a BLC instance contains the ValidateObjects action, which consists of the
PXAction<>
type member declared within the first-level extension and the delegate declared within the second-level extension. To use an action declared within the base BLC or the lower-level extension from the action delegate, you should redeclare the action within a BLC extension. You do not need to redeclare an action when it is not meant to be used from the action delegate.Note: To modify the same member of the base BLC or any BLC extension, you should use extensions of higher levels.