When you have a field, and its value depends on the selection in another field, you may create a Cascading List of Values (LOV). A city field that depend on the selection in country field, is a good example of Cascading LOV. In this post, you will see how simple is, define a Cascading List of Values using ADF 12c.
Download the sample application: ADFCascadingLOVApp.zip.
First of all, we need to create a View Criteria to filter employees by department.
In the Applications window, open the EmployeesView file, and click the View Criteria navigation tab.
In the View Criteria page, click the green plus-sign icon to create the View Criteria.
In the Create View Criteria dialog, change the Criteria Name to EmployeesByDepartmentViewCriteria, click Add Item button and define as “DepartmentId = :CurrentDept”, and click OK.
Now, let’s configure the list of values for the ManagerId attribute.
Click the Attributes navigation tab and select the ManagerId attribute.
Click the List of Values tab, and then click the green plus-sign icon to create a list of values.
In the Create List of Values dialog, click the green plus-sign icon in the List Data Source section and choose the EmployeesView View Object. In the List Attribute section, choose the EmployeeId attribute.
Click the UI Hints tab, select FirstName and LastName attributes and click OK.
Click the Accessors navigation tab, select the EmployeesView1 View Accessor and click the pencil icon.
In the Edit View Accessor dialog, select the EmployeesByDepartmentViewCriteria, set the value of CurrentDept to DepartmentId and click OK.
Don’t forget to configure the List of Values to DepartmentId.
Done!
Run the AppModule and test the Cascading LOV.
Run the Application and test the Cascading LOV.