For refreshing an ADF Table from Managed Bean, you need to first execute the Iterator binding for that table.
Below is an example code that you need to add to your managed bean for executing the iterator.
DCBindingContainer dcBindings = (DCBindingContainer)BindingContext.getCurrent().getCurrentBindingsEntry();
DCIteratorBinding iterBind = null;
if (dcBindings != null) {
iterBind = (DCIteratorBinding)dcBindings.get("iterator name here");
Map map = new HashMap();
map.put("parameter1","parameter value"); //specify parameters for the iterator here
dcBindings.setParameterValues(map);
}
if (iterBind != null) {
iterBind.executeQuery();
}
Specify table binding to the Table you want to refresh. Make sure you define it on your managed bean as transient as it is not serializable.
private transient RichTable myTable;
Once you execute the Iterator, Rerender the table using partial target. Below is a sample code.
AdfFacesContext facesContext = AdfFacesContext.getCurrentInstance();
facesContext.addPartialTarget(specify table binding name);
Import statements for the above code:
import oracle.adf.view.rich.context.AdfFacesContext;
import oracle.adf.model.BindingContext;
import oracle.adf.model.binding.DCBindingContainer;
import oracle.adf.model.binding.DCIteratorBinding;
import java.util.HashMap;
import java.util.Map;
You can also do this by invoke action. Below are the details of how you do it through invoke action.
On page binding of the JSF page. Click on + icon in the Executables section and select invokeAction. It will prompt for Id and the Binds value. You can specify any Id but it should be unique and select Method Action you want it to bind.
Create a boolean field in managed bean with setters and getters.
private boolean refreshTable;
Once you added the invoke action to the page binding, You need to select the invoke action and go to its properties and select Refresh to "ifNeeded" and RefreshCondition to EL expression.
example:
RefreshCondition - {pageFlowScope.myBean.refreshTable}
The table will get refreshed only when refreshTable value is true.
Below is an example code that you need to add to your managed bean for executing the iterator.
DCBindingContainer dcBindings = (DCBindingContainer)BindingContext.getCurrent().getCurrentBindingsEntry();
DCIteratorBinding iterBind = null;
if (dcBindings != null) {
iterBind = (DCIteratorBinding)dcBindings.get("iterator name here");
Map map = new HashMap();
map.put("parameter1","parameter value"); //specify parameters for the iterator here
dcBindings.setParameterValues(map);
}
if (iterBind != null) {
iterBind.executeQuery();
}
Specify table binding to the Table you want to refresh. Make sure you define it on your managed bean as transient as it is not serializable.
private transient RichTable myTable;
Once you execute the Iterator, Rerender the table using partial target. Below is a sample code.
AdfFacesContext facesContext = AdfFacesContext.getCurrentInstance();
facesContext.addPartialTarget(specify table binding name);
Import statements for the above code:
import oracle.adf.view.rich.context.AdfFacesContext;
import oracle.adf.model.BindingContext;
import oracle.adf.model.binding.DCBindingContainer;
import oracle.adf.model.binding.DCIteratorBinding;
import java.util.HashMap;
import java.util.Map;
You can also do this by invoke action. Below are the details of how you do it through invoke action.
On page binding of the JSF page. Click on + icon in the Executables section and select invokeAction. It will prompt for Id and the Binds value. You can specify any Id but it should be unique and select Method Action you want it to bind.
Create a boolean field in managed bean with setters and getters.
private boolean refreshTable;
Once you added the invoke action to the page binding, You need to select the invoke action and go to its properties and select Refresh to "ifNeeded" and RefreshCondition to EL expression.
example:
RefreshCondition - {pageFlowScope.myBean.refreshTable}
The table will get refreshed only when refreshTable value is true.
No comments:
Post a Comment