In this post i would be providing the sample code for refreshing the parent node based on the child node.
Scenario:
In cases like when we change the values in the child node it would do some calculations and the corresponding parent row needs to get refreshed. For this we need to do ppr for the adf tree table, with out providing ppr for the entire tree table we can just refresh the parent row alone.
Below is the code for it
public void refresh_parentrow(){
JUCtrlHierNodeBinding parentNode = (JUCtrlHierNodeBinding)ADFUtils.evaluateEL("#{row.parent}");
if (parentNode != null) {
List parentKey = parentNode.getKeyPath();
if (parentKey != null) {
FacesContext facesContext = FacesContext.getCurrentInstance();
RichTreeTable richTreeTable = this.getTreeTable();
String clientRowKey = richTreeTable.getClientRowKeyManager().getClientRowKey(facesContext,
richTreeTable,
parentKey);
if(clientRowKey != null) {
String currentClientRowKey = richTreeTable.getClientRowKey();
try {
richTreeTable.setClientRowKey(clientRowKey);
RichInputText netWeightComp = this.getNetWeightComp();
AdfFacesContext afContext = AdfFacesContext.getCurrentInstance();
afContext.addPartialTarget(attrComp);
//attrComp - Binding of the attribute which needs to be refreshed.
} finally {
richTreeTable.setClientRowKey(currentClientRowKey);
}
}
}
}
}
Soon, i will explain you in detail with sample examples and codes in the upcoming post.
Scenario:
In cases like when we change the values in the child node it would do some calculations and the corresponding parent row needs to get refreshed. For this we need to do ppr for the adf tree table, with out providing ppr for the entire tree table we can just refresh the parent row alone.
Below is the code for it
public void refresh_parentrow(){
JUCtrlHierNodeBinding parentNode = (JUCtrlHierNodeBinding)ADFUtils.evaluateEL("#{row.parent}");
if (parentNode != null) {
List parentKey = parentNode.getKeyPath();
if (parentKey != null) {
FacesContext facesContext = FacesContext.getCurrentInstance();
RichTreeTable richTreeTable = this.getTreeTable();
String clientRowKey = richTreeTable.getClientRowKeyManager().getClientRowKey(facesContext,
richTreeTable,
parentKey);
if(clientRowKey != null) {
String currentClientRowKey = richTreeTable.getClientRowKey();
try {
richTreeTable.setClientRowKey(clientRowKey);
RichInputText netWeightComp = this.getNetWeightComp();
AdfFacesContext afContext = AdfFacesContext.getCurrentInstance();
afContext.addPartialTarget(attrComp);
//attrComp - Binding of the attribute which needs to be refreshed.
} finally {
richTreeTable.setClientRowKey(currentClientRowKey);
}
}
}
}
}
Soon, i will explain you in detail with sample examples and codes in the upcoming post.