Wednesday, 22 January 2014

Oracle ADF. Master-Details relation with “details” being displayed as inline row details

 

This post was developed with Jdeveloper 11g R2 (11.1.2.3)

ADF supports out of the box master details relation. You can define the View Link and drop the child VO from the “Data Control” section and ADF will ask you what kind of “Master-Details” do you want to create. If you choose “Master table – Details table”, the ADF will generate for you 2 table one above other.

   However it may be much nicer to display the detail table inline with master row.

Note!!!! Don’t confuse it with a “tree” component

I will use the HR sample schema from Oracle to present the employees of specific department.

First of all we will create the model. Do not create the View Link between “Departments” and “Employees”.

For department just create VO based on SQL

select * from departments

select * from departments

image


For employees create VO with bind variables


image


 


Our idea will be the following. We will display the details in the iframe component.


Create new bounded task flow.


image


In the property of the flow make the following changes


image


It means that you can directly access this task flow from URL and it accepts the “pDept” parameter


Drag “exceute with params” from Data Control for Employees VO and use pageFlowScope.dept value (that we used to store the URL parameters) as input parameter


Create new page view to display the “Employees” table.


image


image


Test your work by running the task flow XML


image


You will be prompted to enter the parameter. Put some value (I put 60).


Note the “pDept” appears in the URL.


image


Now create a page and drag to it the “Departments” VO from the data control


image


Add to the table “detailsStamp” facet and insert into the facet the “inlineFrame” component


image


For the frame source , put the url to details-flow XML file and use “department id” as dynamic parameter


 


image


Run the application


image


image


Download the workspace from this link


 


 



2 comments: