Saturday, January 14, 2017

AF:Table - Attribute updatable / Not based on condition

To make specific row read only based on it importance like Job id AD_VP / for old record like hire date more than one year with current date .
Generate Impl class for Employee Entity Object.
Override isAttributeUpdateable method as shown below.

 @Override 
    public boolean isAttributeUpdateable(int i) {
       
    if(this.getJobId().equalsIgnoreCase("ad_vp") || this.getHiredateIndicator().compareTo(365)>0)
    
    {
        return false;
    }
      else{
        
          return super.isAttributeUpdateable(i);
        }
    
    }

and then to calculate duration of employee with respect to current date created Transient attribute HiredateIndicator in EmployeeEO and added below expression in value filed.

Exp # if(HireDate!=null){ return adf.currentDate-HireDate;}  return null;

once you run page it will looks like below.







Only the highlighted row can be editable remaining all are read only .



No comments:

Post a Comment