In many cases, we will have to use cascading lists of values, also called dependent lists of values in our ADF application. Cascading lists of values, in its name, means one set of list of values are dependent on selected value on another set of list of values.
How does it work is apply view criteria to a model driven list of value.
ManagerId attribute needs a view accessor from EmployeesVO itself with additional attributes: Firstname and LastName.
Then we have to add the view criteria to the view accessor. In the "Bind Parameter Values" section, type in the value "DepartmentId' using Groovy script.
Employee is based on selected managerId. So a view criteria needs to be applied on its view accessor - EmployeesVO.
Similarly, we will add the view criteria into the view accessor.
How does it work is apply view criteria to a model driven list of value.
Here I present one example in HR schema. Let's say we have a list of departments, when one department value is selected, a second list of values - manager will be set to managers within the selected departments, a third list of values - employees will be set to employees under the selected manager.
First, we create our base VO - EmployeesVO (can be created from Entity object also)
Second, we create 3 list of values for 3 attributes we are interested in EmployeesVO: DepartmentId, ManagerId, EmployeeId.
Each list of value needs a view accessor (data source for the LOV).
DepartmentId attribute needs a view accessor from DeptListVO, which is based on query "select department_id, department_name from departments".
ManagerId attribute needs a view accessor from EmployeesVO itself with additional attributes: Firstname and LastName.
ManagerId is based on selected departmentId, so we have to create a view criteria on its view accessor - EmployeesVO.
Then we have to add the view criteria to the view accessor. In the "Bind Parameter Values" section, type in the value "DepartmentId' using Groovy script.
EmployeeId attribute needs a view accesor from EmployeesVO like managerId. Create a LOV based on EmployeesVO view accessor.
Employee is based on selected managerId. So a view criteria needs to be applied on its view accessor - EmployeesVO.
Similarly, we will add the view criteria into the view accessor.
Now we create the UI for the list of values.
Please note for the UI to work with dependent lists of values, the properties of the parent LOV has to be set as: "AutoSubmit: true" and the partial trigger property of its child LOV has to be set as its parent LOV id.
Finally it works as this:
1. select a department id.
3. the employees then display only the ones under the selected manager.
Comments