Monday, May 12, 2014

populate af:table based on value selected from dropdown : Query with Paramenter

This demonstration is a simple example, where an adf table dynamically changed based on some value selected from select on choice.
This example is based on HR schema, where value selected in department dropdown, populates the table which contains list of employee belonging to that department
 It can be done in multiple ways, i'll be demonstrating in 2 ways here.
This blog covers the option where it is done by using paramentrized query.

1. Create 2 view objects:
       a. DepartmentVO : select * from departments

       b. EmployeeDeptVO : select * from employee where department_Id-:dept where dept is a bind variable

2.in data control palatte, look out for Execute with param under EmployeeDeptVO

3. drag n drop the dept on jspf page as single selection


Make sure to add the departmentVO1 as list of data source and also change the display name to Department Name

4. Now drag and drop the ExecutewithParams from datacontrol palette on page as adf button(or as desired)

5. Once this is done, its time to select the EmployeeDeptVO on page as adf table with desired attributes:



6. Run the application and there you have a page, where on selecting the department id from drop down, all the employees of the department can be seen






No comments:

Post a Comment