By Steven Davelaar on Feb 10, 2012
Written By Peter Koletzke, 8 February, 2012 (posted by Steven)
While searching for employees, users need to find a department by first finding a location from a City LOV (dropdown list). After selecting a city, the City and Postal Code appear on the screen. LocationId also returns from the LOV, but is hidden because users should not see the ID.
Then the user opens a Departments LOV (pop up LOV with query fields), which displays only departments within the selected city. After selecting a department, the Department ID and Department Name are returned to the screen.
Implementing a cascading LOV consists mostly of work in the Model project. It is important that you prove that the cascading LOV works in the Model project before implementing it in the ViewController project. A brief list of the special components and settings needed to implement a cascading LOV follows.
- Base view object for the Employees entity object: EmployeeMaster
- Read-only view objects for the Locations LOV and Departments LOV queries
- View criteria on the Departments LOV to represent a WHERE clause for location_id = :bind_variable
- Locations and Departments added as reference entity objects to EmployeeMaster
- Calculated attributes in EmployeesMaster as follows. All have Queryable as “true” and Display Hint as “Display.”
- LocCity (LOCATIONS.CITY)
- LocPostalCode (LOCATIONS.POSTAL_CODE)
- LocLocationId (LOCATIONS.LOCATION_ID)
- DeptDepartmentName (DEPARTMENTS.DEPARTMENT_ID)
- Locations LOV on the Employees.LocCity attribute, returns city, location ID (hidden), and postal code
- Departments LOV on the Employees.DepartmentName, returns DepartmentName and DepartmentId, uses DepartmentsLOV view object accessor with the detail LOV view criteria mentioned above (parameter value = LocLocationId)
- AutoSubmit UI hint set for the two LOV items: LocCity, DeptDepartmentName
- Dependencies to LocCity from DeptDepartmentName and DepartmentId (so they clear when the city changes)
- View criteria on EmployeeMaster for a list of attributes needed in Quick Search area. An additional view criteria is needed for the Advanced Search area. LocLocationId is listed in both view criteria, but its UI Hint for Rendered Mode is “Never.” Deselect Show in List on the UI Hints tab.
All actions are in the JHS application definition editor unless noted.
- Set the LocLocationId item so it does not display in the table or in the form.
- Set Quick Search View criteria and Advanced Search View criteria properties to the names of the appropriate (but separate) view criteria you created for to list attributes in these search sections
- Set Depends On Item(s) properties for LocPostalCode as “LocCity,” for DepartmentId as “DeptDepartmentName,LocCity” so the LOV return fields on the edit page are set after an LOV selection.
- Select the Clear/Refresh Value? property for DepartmentId so it clears when the city or department name changes.
- For JHS 220.127.116.11: select Clear/Refresh? Value for DeptDepartmentName.
- For JHS 18.104.22.168: edit adf-config-EmployeeMaster.xml after generation to define a depends-on refresh for DeptDepartmentName.