Saturday, November 3, 2012

Cascading LOV's in JDeveloper 11.1.2.3.0

Blog reader was asking about cascading LOV's support in JDeveloper 11.1.2.3.0 (latest release). Question was based on my old post from 2008 - Cascading LOV's in Oracle ADF 11g Update 1. Things changed since then - its easier to implement cascading LOV's with the latest JDeveloper 11g releases. I decided to update old sample application and describe how you can implement such functionality using ADF BC declarative tools.

Here is updated sample application - CascadingLOV_v2.zip. This sample is based on custom table - Vacationrequests (sql is script is provided). Two cascading LOV's are implemented with one master LOV (Locations -> Departments -> Employees):


There is no need to perform any additional configuration for ADF UI (opposite from before), cascading LOV field will be refreshed automatically. Here we are creating new record and cascading LOV works for the new record:


We change master LOV value to be 1500:


Dependent LOV values for Departments -> Employees are cleared automatically:


Same works for ADF table component, change master LOV to be 1800:


Dependent columns are cleared - bind variable value is reset:


Now I will present 4 steps, describing how this functionality is implemented.

Step 1

Dependent LOV VO must have View Criteria, it filters based on bind variable value:


Step 2

View Accessor from main VO (Vacationrequests) contains bind variable and sets value from the parent:


Step 3

Set Auto Submit = True for master attribute on VO level. This allows to simulate AutoSubmit behavior on ADF UI and reset dependent LOV bing variable value:


Step 4

Set dependency on VO level for cascading LOV attribute from the parent - this will force dependent LOV to clear its value after changes in master LOV:


2 comments:

Anonymous said...

Hello!
I try you example on my app. View criteria not applied if LOV view from shared AM (Jdev 11.1.1.6). Please, can you check it?

Andrejus Baranovskis said...

Why would you use AM for LOV instance? LOV instance is declared directly on VO and criteria is applied there.

Andrejus