How to create multi level cascading (dependent) list of values using BC4J
By Arunkumar Ramamoorthy on Aug 10, 2012
There are quite a number of documentations / blogs on creating cascading (dependent) list of values in ADF Application using BC4J as model.
However, these entries talk about creating list of values for master-detail attributes. In this article, I would be explaining about creating list of values which have master-detail-grand detail relationship (though the implementation is same, the use case is different).
Assuming that we've our model ready, with an VO for Person (based on Person EO), Country, State and City (read-only VOs).
Now, we'll modify the query of the dependent VOs to include a bind variable in their where clause.
We could then create List of Values for the CountryId, StateId and CityId attributes in the Person VO.
Above image shows an example for creating LOV for the CityId attribute. LOV is created for the CountryId and StateId attributes in the similar fashion.
Now that we've created LOV for all the 3 attributes, we need to pass the required values for the bind variable we created previously (in State and City VOs). That is done from the View Accessors tab of Person VO.
Now we are set to go with the dependent LOV. Before running the Tester, we need to make the CountryId and StateId attributes automatically submit their values upon change (by setting Auto Submit UI Hint to true)
(Above image shows setting Auto Submit UI Hint to true for CountryId attribute. In the same manner, set the Auto Submit UI Hint to true for the StateId attribute as well).
and add make StateId dependent on CountryId, CityId to depend on CountryId and StateId.
We are set to go now. Run the AppModule tester to verify the values.
When using this in jspx page, set the AutoSubmit properties for the CountryId and StateId components, and add the partialTriggers for StateId and CityId components with the Id of CountryId component, as shown below.
Hint: Right click on the images and select View Image to view it completely if it is cropped.