Wednesday, October 3, 2012
ADF - How to submit/post values changes to database immediately in ADF UI components
When you want to persist changes to a database as soon as a user changes the value in any of the UI Components. you can use the below technique.
1. Add a value change listener to your UI Component and also make Auto Submit to true.
<af:selectOneChoice value="{row.bindings.reasonCode.inputValue}"
label="#{row.bindings.reasonCode.label}" id="soc1" autoSubmit="true"
valueChangeListener="#{failures.reasoncodeChange}">
<f:selectItems value="#{row.bindings.reasonCode.items}" id="si1"/>
</af:selectOneChoice>
2. In the Backing bean value change listener method
valueChangeEvent.getComponent().processUpdates(FacesContext.getCurrentInstance());
Calling the the above line will do all the model updates. refer the link
public void reasoncodeChange(ValueChangeEvent valueChangeEvent) {
valueChangeEvent.getComponent().processUpdates(FacesContext.getCurrentInstance());BindingContainer bindings = getBindings();
OperationBinding operationBinding =bindings.getOperationBinding("Commit");
operationBinding.execute();
}
Subscribe to:
Posts (Atom)