Creating controls to add and delete documents

The SiteList XPage lets you see and edit documents in the application, but we need to add controls to create and delete documents.

About this task

Do the following:

Procedure

  1. On the SiteList XPage, click inside the first column (the column, not the header) so it is in focus.
  2. Under Properties, click Display.
  3. Check Check box.
    This puts a check box at the front of each row. The user can select a row by checking a box.
  4. On the XPage, click at the ending of the title and press Enter to put a blank line between the title and the view control.
  5. If you don't see the list of controls in the right pane, click the Controls tab or click Window > Show Eclipse Views > Controls.
  6. Drag a Button control onto the empty line under the title and do the following:
    1. Under Properties on the bottom pane, click Button if it is not already in focus.
    2. Change the label to New Site.
    3. Click the Events tab.
    4. Ensure that the onClick event is selected.
    5. Click Add Action.
      The Add Simple Action dialog box opens. The category should read All and the action Open Page. Adjust if this is not so.
    6. Select Site for the name of the page to open.
    7. Select New Document for the target document.
    The dialog box should look like this.
    Add Simple Action dialog box
  7. Click OK.
  8. Drag a second Button control alongside the first and do the following:
    1. On the bottom pane, click the Properties tab and click Button if it is not already in focus.
    2. Change the label to Delete Selected.
    3. Click the Events tab.
    4. Ensure that onclick is selected.
    5. Click Add Action.
    6. Select Document for the category.
    7. Select Delete Selected Documents for the action.
    8. Select viewPanel1 for the view name.

      If this is not the name of your view control, select your view control.

    9. Type Do you really want to delete the checked sites? for the confirmation text.

    The dialog box should look like this.

    Add Simple Action dialog box
  9. Click OK.
  10. Press Ctrl+S to save the page.
  11. Preview the page as desired.
  12. Close the SiteList XPage by clicking the X at the upper right of the center pane.

Results

At this point, your XPage should be similar to SiteListFinal which you can open for comparison.