Pages

Saturday, May 22, 2010

Step 8 – Apex Developer Day - Adding a Master Detail Form

Even though Projects and Tasks are stored in two separate tables, it is useful to display their information on one page. A Master-Detail form enables you to do just that. To add a Master-Detail form, perform the following steps:

0. Click Create Page.

clip_image002

1. Select the Form page type and click Next .

clip_image004

2. Select Master Detail Form and click Next >.

clip_image006

3. You first select the Master table. Select APEX_PROJECT_LOOKUP for the Table/View Name and click the Select All (clip_image008) icon to move all the columns to the Displayed Columns area. Then click Next >.

clip_image010

4. Next, you select the Detail table. Select APEX_TASKS for the Table / View Name and click the Select All ( clip_image008[1]) icon to move all the columns to the Displayed Columns area. Then click Next >.

clip_image012

5. When the table APEX_PROJECT_LOOKUP was created, a trigger was also created to invoke the sequence when a row is inserted. Accept the default to use an Existing Trigger and click Next >.

clip_image014

6. Click Next > to use the Existing Trigger on the APEX_TASKS.

clip_image016

7. For Include master row navigation, select Yes. This selection allows a user to scroll through projects on the Master-Detail page.

For Master Row Navigation Order, select PROJECT. This selection makes the next project displayed, the next one alphabetically by project name. If you chose PROJECT_ID, the next record would be calculated by PROJECT_ID and that would be confusing to the user.

For Include master report, select Yes. This section creates a page, in addition to the master/detail, that is a report of all projects. The report also contains navigation to the Master-Detail page.

When done making your selections, click Next >.

clip_image018

8. Make sure Edit detail as tabular form on same page is selected and click Next >.

By selecting to edit detail as a tabular form on the same page, the tasks report on the Master-Detail page is editable. If you selected edit detail on a separate page, the tasks report would just be a report and editing would be per record on a separate page.

clip_image020

9. Under the Create Breadcrumb Entry section, change the Entry Name (Master Report) to Projects and Entry Name (Master Detail Page) to Projects and Tasks. Then click the Home link to set the parent breadcrumb of the new Projects report to Home. This selection makes it navigatable from the Home page.

clip_image022

10. Click Next .

11. Accept the defaults of Do not use tabs and click Next > .

clip_image024

12. Click Create to create the Master Detail Form.

clip_image026

13. Click the Run Page icon.

clip_image028

14. Enter the login information if it is requested.

clip_image030

15. A report containing the list of projects is automatically created. Select the Edit ( clip_image032)icon next to one of the projects to view the Master detail Form.

clip_image034

16. The Master Detail Form is shown. This page allows a user to edit the details of the Project as well as the details of the Tasks associated with the Project. It also allows users to add new tasks to the current project.

In the detail region, you see an Add Row button. This button saves any pending changes and then adds another row so that a new task can be added to the project. You should also have a Delete button. This button is used in conjunction with the check boxes to the left of each Task. The check box in the header row is used to select all of the tasks displayed on the page. When you click the Delete button, any tasks that have been "checked" are deleted. If you use this feature, you notice that a deletion confirmation has been built in. This asks you to confirm your deletion before proceeding.

In addition, you see a Previous and Cancel button for each area on the form. The upper set of buttons correspond to the Project Information and the lower set of buttons correspond to the Tasks. The Previous button appears because you selected to include Master row navigation. The Cancel button returns the user to the Projects report.

Change the name of the project and click Apply Changes.

clip_image036

17. Your changes were made. Click the Application <n>link in the developer toolbar.

clip_image038

No comments:

Post a Comment