13 September, 2011

ADF Cascading Lov


I will present how to do cascading lov in ADF.
Cascading Lov means that another lov its query depend on another Lov selected value.

I will create example for employees
I created two Lovs DepartmentId, ManagerId which ManagerId lov retrieve only employees that thier departments selected in DepartmentId Lov.

I will create DepartmentId Lov as below






Then create ManagerId Lov that will be dependent on DepartmentId
We need to define View Criteria on dependent LOV component and specify Bind variable.



We set Display Hint for bind variable to Hide. This will allow to hide Bind variable in LOV component and not to render it on UI:



We will define LOV for ManagerId attribute, in View Accessor select defined View Criteria and specify value for Bind variable as below



In ViewController,set DepartmentId component AutoSubmit = true for parent LOV's and set ManagerId component PartialTriggers to the Id of DepartmentId component

We will create Value Change Listener methods for  DepartmentId component for clearing values in ManagerId components:



The view of page at run-time so you can test the result


You can download the sample example from here using Jdeveloper 11.1.2.0

Thanks
Mahmoud A. El-Sayed

1 comment:

  1. I didn't take care of NULL value in the below code line
    if(valueChangeEvent.getNewValue()!= valueChangeEvent.getOldValue()){

    So you could update code to avoid NullPointerException if user doesn't enter data in item

    ReplyDelete

ADF : Scope Variables

Oracle ADF uses many variables and each variable has a scope. There are five scopes in ADF (Application, Request, Session, View and PageFl...