How To Override Base Event In Acumatica
16 March 2015
Hello everybody,
Imagine following scenario. You have some code in base class, which you need to change. How to do it. For this purpose you can use PXOverride attribute.
See the following code:
public class YourExtension : PXGraphExtension<SomeBasicGraph> { [PXOverride] public void MethodForOverriding(string viewName, IEnumerable items) { // Method body
}
}
In case which is presented MethodForOverriding of base class will be called. If you want to avoid it, you can add additional argument to the code, and then manipulate how to call it or even omit calling of method from base logic. Look at the following code:
public class YourExtension : PXGraphExtension<SomeBasicGraph> { [PXOverride] public void MethodForOverriding(string viewName, IDictionary keys, IDictionary values, Func<string, IDictionary, IDictionary, int> methodDel) { //some your code int res = methodDel(viewName, keys, values); //again some of your code. For example you can modify res. return res; } }