We use all employees attributes with include navigation controls plus include submit button.
Now go to the pagedef of this page where we create a list of values binding on the department iterator. We need this for the lov page
We don't have the department iterator so we have to select it first.
We select all the attributes of the department iterator.
Open the pagedef and rename the list of values ID to DeptnoLOV. This is how the list of values looks in the pagedef.
Now go to the page and select the last column and insert input list of values.
Now we update the af:inputListOfValues element in jspx page with this one
returnPopupListener attribute of inputListOfValues is very important, here is the method defined which copies the value of the lov to the deptno of the employee. You can also have launchPopupListener where you can limit the records of the lov.
package nl.ordina.beans;
import javax.el.ELContext;
import javax.el.ExpressionFactory;
import javax.el.ValueExpression;
import javax.faces.application.Application;
import javax.faces.context.FacesContext;
import oracle.adf.model.binding.DCIteratorBinding;
import oracle.adf.view.rich.event.ReturnPopupEvent;
import oracle.binding.BindingContainer;
import oracle.jbo.Row;
public class LovDepartment {
public void DeptLOVReturnListener(ReturnPopupEvent returnPopupEvent) {
// Add event code here...
DCIteratorBinding EmpViewIterator = (DCIteratorBinding) getBindings().get("EmpView1Iterator");
Row rw = EmpViewIterator.getViewObject().getCurrentRow();
rw.setAttribute("Deptno",getDeptLovID());
}
private BindingContainer getBindings() {
FacesContext fc = FacesContext.getCurrentInstance();
Application app = fc.getApplication();
ExpressionFactory elFactory = app.getExpressionFactory();
ELContext elContext = fc.getELContext();
ValueExpression valueExp = elFactory.createValueExpression(elContext, "#{bindings}", Object.class);
return (BindingContainer) valueExp.getValue(elContext);
}
private String getDeptLovID() {
FacesContext fc = FacesContext.getCurrentInstance();
Application app = fc.getApplication();
ExpressionFactory elFactory = app.getExpressionFactory();
ELContext elContext = fc.getELContext();
ValueExpression valueExp = elFactory.createValueExpression(elContext, "#{bindings.DeptnoLOV.inputValue}", Object.class);
return valueExp.getValue(elContext).toString();
}
}
We only have to register this bean in the adfc-config.xml
Now we can delete in the jsf page the deptno column of the employee form because we have now the lov. If you don't like the LOV or inputListOfValues you can also use a combobox or inputComboboxListOfValues. You only have to use this code in the page and replace the inputListOfValues element.
Here you have the example project
Hi,
ReplyDeleteCan you tell us please how can we pdate an LOV after doing an add or delete into the binded table
Thanks
Mourado please can you explain what your problem is.
ReplyDeletethanks
Hi,
ReplyDeleteI am asking when we have a LOV and we
add or delete some data from the table Like Employee how the LOV is updated
If you use the bc4j lov you can update the lov with the advanced properties
ReplyDeletein my example you have to edit the listofvalues attribute in the pagedef
This comment has been removed by a blog administrator.
ReplyDeleteCan you please give some details on latest inputComboboxListOfValues?
ReplyDeletecan you please tell how to add a Create Popup for InputComboboxListOfValues? Thanks a bunch
ReplyDeleteJaya