Post Attribute Change
Sometimes you have some logic that you want to execute after an attribute has been changed. For this we introduced the PostAttributeChange annotation to be used on a method in your Customization Java Class.Â
This annotation will monitor an attribute based on the method signature.Â
Â
@PostAttrChange public void salaryChanged(AttrChangeEvent event) { event.getElement().putInternal("commissionPercentage", null); }
Â
The method signature needs to start with the attribute name with Changed as suffix. The argument is an AttrChangeEvent.
The AttrChangeEvent will contain attribute name, old value, new value and XMLDCElement (aka ViewRow).
In this case, we will clear the commissionPercentage field if the salary changes.
Â
The AttrChangeEvent will contain attribute name, old value, new value and XMLDCElement (aka ViewRow).
In this case, we will clear the commissionPercentage field if the salary changes.
Â
Â
Employee with commissionPercentage | Change the Salary from 2900 to 3100 | commissionPercentage will be cleared |