days
-1
-2
hours
0
-2
minutes
-5
-6
seconds
-5
-1
search
Tutorial

Display Master-Detail View in ADF as you wish

Denis Danov
Generic
Tutorial image via Shutterstock

In this article Denis Danov, Java EE developer at Dreamix, sheds some light on the Master-Detail view and teaches us how to show it in the UI.

Master-Detail View in ADF business components is something very common.

This represents data that is retrieved from somewhere (usually this is the database); this data has some one-to-many relations.

In order to have a better picture in our heads, let’s think of a big company, which most probably has several departments and in each department there are many employees. The relationship between a department and its employee is one-to-many (one department has many employees).

In ADF Business Components you can easily explain that relationship via a view link between the master view (the department) and the detail view (employee).

How to show the Master-Detail View in the UI

In ADF you have some out-of-the-box ways to display such data. You can use a Master-Detail table or something else that suits your needs.

But what happens when your customers wish to see the data in a custom way? This happened to me recently. I will try to explain the problem and the solution with the above-mentioned department-employee example.

Let’s say we want to display horizontally all our departments and under each department we want to show a table containing all the employees that are working in this department. So we want to achieve something like this:

1

So let’s go through the implementation of our solution:

1.Create the view link one-to-many. Make sure that the generate accessor option is selected.

2

3

2. If the accessor is not visible in the Rom Implementation, you need to regenerate the Java class for that Row.

4

3. Add the Master-Detail View in the Application Module.

5

4. Create a department iterator binding in the page where you want to display the data.

You can use that by dragging and dropping the view as a table on the page and then delete the generated UI components. We only need the bindings in the page definition file.

5. Edit the tree binding and add the details view to it. Select which attributes you want to use from the details view.

6

7

You can use this approach vice-versa too (a table for the master and a column that hold details values). It depends on your scenario and requirements.

Please share your personal experience if you used different approaches to fulfill such requirements.

Author
Denis Danov
Denis is a Java EE and Oracle Developer at Dreamix. // If this tutorial was interesting for you and you want to get the code so you can examine it, please e-mail me at denis.danov@dreamix.eu and I will send it to you.

Leave a Reply

Be the First to Comment!

avatar
400
  Subscribe  
Notify of