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.
 

 

Employee with commissionPercentageChange the Salary from 2900 to 3100commissionPercentage will be cleared