Default value to view attribute using other attribute of same row
Some time requirement will come in development to set some view-obejct attribute based on other attribute. This post will guide you how to achieve this functionality without even using the groovy expression.
Here in this post I am using ViewRowImpl to achieve this requirement.
I defined ViewRowImpl as shown below
By checking include accessors means setter/getter for each attribute is generated in ViewRowImpl class.
Here we have 3 column SUID, ID and Name on save i want to copy id data to SUID fields.
public void setId(Number value) {
setAttributeInternal(ID, value);
setAttributeInternal(SUID, value);
}
setAttributeInternal(ID, value);
setAttributeInternal(SUID, value);
}
above code successfully set ID column data to SUID.
find the sample application with source and table script Application