Lately a user on OTN JDeveloper and ADF forum ask how to cascade to tables instead of two LOV components. My first thought was to use an af:treeTable, however, this would give the user a different experience then you get from a cascading LOV. In the end I build a small test case using the HR db schema using the departments as master table and the employees of the selected departments as detail table. At the end of the post you’ll find the link to the sample workspace.
The sample is very simple as it only has the departments with the cascading employees view as data model.
The view controller is simple too. Its consists of only one page which holds a region. Inside the region are two panelCollection components, one holding the departments as table (read only, single selection mode) and one holding the cascading employees table (read only, single selection mode).
The magic which make the sample work, is the partial trigger which is used on the employee table and is listening on the departments table. The selection of the employees is done in the model via the viewLink which is automatically setup when you create the business components from the HR tables.
When you run the sample, which was build using JDev 11.1.2.1.0, you see the that the first row of the departments table is selected and the employees of this department in the lower table.
If you select an other row in the department table you see the different employees in the lower table
To summarize this blog, I can say that the implementation of the use case did not need one line of java code. The solution was easy to archive by only using a declarative approach.
You can download the sample workspace, build with JDev 11.1.2.1.0 and depending on hte HR db schema, from here: BlogCascadingTables.zip
Please rename the file to ‘.zip’ after downloading it!
Hi,
I need this exactly behaviour in my application. I’ve followed step by step what you described in this post but it does’nt work. I’m using jdev 12.1.3, do you know if something could have changed on this topic?
The behaviour I see in my application is that the trigger is really executed since I see my second table (the dependant one) blink for a second when I choose anything on the first one but for any record I select on the first table it always show me all the entries in the second table, not just the ones linked by the foreign key (it shows me in all the cases the full table, like the where clause on the link did’nt work out).
Does it sounds familiar?
thanks!
I’ll check it out…
Thanks!
Wouldnt need an autosubmit somewhere,or a way to bind the row id from first table with the appropiate field in the second?
Have you checked the sample which you can download from the blog? I checked it out using jdev 12.1.3 and it worked as expected. There is on other sample showing how to do it with multiple tables at https://tompeez.wordpress.com/2012/04/18/jdeveloper-adf-multiple-cascading-tables/
This sample works using jdev 1.2.3 too.
Hi,
Thanks for your reply. I’ve finally solved the problem and now it’s working fine! I was doing a noob mistake since the table data control I was draging to render my dependant table wasn’t the one under the first’s table Data Control, but the one at the same level, so the data that was displaying my table was always the full content of the table instead of the data depending from the selected field of the 1st table.
Thank you anyway for your time, and for your blog!