Got to Love Cascading LOVs in ADF

"You've got to love our cascading LOVs" was the title of an email from Maiko that pointed to a long and complex tutorial that shows how non-trivial implementing cascading lists is when you use ExtJS, Hibernate and Spring. You basically end up writing over 300 lines of code in a mixture of languages including java, javascript and json.

This is indeed one of many areas where you can clearly see the advantages that ADF gives you with a declarative development approach.
Check out this little demo that shows how you build this type of cascading lists with JDeveloper and ADF. The interesting point to note is that a single SQL statement is the only manual line of code you end up writing.

This is why we believe that visual and declarative is good.

By the way, if you prefer written instructions for this, you can use either Steve's Article or this part of the ADF BC tutorial.

Comments:

good effort

Posted by Abbas on October 28, 2010 at 04:43 PM PDT #

Great video, very helpful. What is not described is how you can manage the return values of the list boxes. How do we overcome the (known?) problem that the selectItems returns an index of the selected option and not the value of the option itself?

Posted by nikos on November 07, 2010 at 05:22 PM PST #

One way to get the value of the selectOneChoice is explained in this how-to: http://www.oracle.com/technetwork/developer-tools/jdev/listbindingvalue-088449.html

Posted by shay.shmeltzer on November 08, 2010 at 01:17 AM PST #

Thanks a lot! I've been trying days to make this work. Perhaps this would be obvious to more experienced ADF developers but i am mentioning it just in case: you need to set all the cascading lists (and not just the parent one) to autoSubmit="true" to get their values in the way described in the link above.

Posted by nikos on November 08, 2010 at 03:33 PM PST #

Hi I tried this and it is working. Thank you very much. I just have one question. If I do not select the country in the poplist, how to display all states from all countries. This might not make sense in case of countries and states, but what I tried is for Organization and Items. If the organization is not selected, I have to display all the items for all organizations. If one organization is selected, I have to display items only for that organization. Thanks and Regards Sameer

Posted by Sameer on November 14, 2010 at 11:28 PM PST #

I think you'll need to change the SQL for your LOV to something like: where country_id=nvl(:p_country,country_id) This will bring all the values when p_country is null.

Posted by shay.shmeltzer on November 15, 2010 at 05:53 AM PST #

Good post.. very helpful.. thank you

Posted by sandy on November 16, 2010 at 02:05 PM PST #

Hi Shay,

Is there any way to create cascade LOV with multiselect in View Criteria.
Ex. If a select multiple Countries from the parent LOV, the child LOV would display the list of States for the selected Countries.

Regards,
Koushik

Posted by guest on August 30, 2011 at 01:27 AM PDT #

Hi Shay. I was not able to get this to work in 11.1.2.1. The model tester worked flawlessly. However, on the JSF page, I get the following exception when switching between countries with states and countries with fewer states after selecting a state:
ADF_FACES-60098:Faces lifecycle receives unhandled exceptions in phase RENDER_RESPONSE 6
java.lang.ArrayIndexOutOfBoundsException: 3

Posted by guest on April 16, 2012 at 07:29 AM PDT #

Here you explained dependent LOV only for 2 values. please anybody tell how to get LOV's for 4 dependent
values i.e four selectonechoice feilds.

Posted by guest on January 17, 2014 at 02:52 AM PST #

Post a Comment:
  • HTML Syntax: NOT allowed
About

me
I'm a Director of Product Management for the Oracle Java Development Tools.
Follow me:
Search

Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today