Create a page for viewing blog entries
In this section, create a page and add a view control to it that displays the saved blog entries.
- Select the HS_Blog component in the Designer Navigator to give it focus.
- Right-click
Pagesin the Designer Navigator and select New Page. - In the New Page window, type
viewBlogEntryin the Name field. - In the Description field, type
This page is for viewing a list of blog entries. - In the Data section, select Do not create a data source.
- In the Component list, select HS_Blog.
- Check Create in default location. Your screen should look like Figure 10.
Figure 10. New viewBlogEntry page
- Click OK.
Now that you have created the viewBlogEntry page, add controls and a view to the page.
- In the Container Controls section of the UI Controls palette, click Table and then drag it to the top portion of the viewBlogEntry page in the page editor.
- From the main menu, select Table > Append Row(s) and type
2in the Append Rows window, then click OK. You should now have two columns and four rows. - In the Core Controls section of the UI Controls palette, click Image and drag it to the first column cell/first row cell of the table.
- In the Select Image window, shown in Figure 11, click Add Image.
Figure 11. Select Image window
- In the Import Image window, click Browse. Select a graphic from your filesystem (we'll use bloglogo.gif in this example), and then click OK to import the image.
- In the Select Image window, select bloglogo.gif and click OK.
- Next to the image in the first row, type
Designer Hands-On Blog, as shown in Figure 12.
Figure 12. Add image to page
Now add a view control to the page. This view will list all the blog entries that are created by a user.
- In the Container Controls section of the UI Controls palette, click View and
drag it to the fourth row and first column of the table. The Select View Query window
opens:
Figure 13. Select View Query window
- In the Select Query for View window:
- In the Type of query list, select New View Query.
- In the Name field, type
blogView. - In the Outline Information section, put a checkmark next to blogEntry.
- Click OK.
- Choose File > Save, but do not close the viewBlogEntry page.
Your view control in the page editor should now look like Figure 14.
Figure 14. View control on page
Next, update the view control to include the columns of data that you want to see.
- Inside the view control, select the second row.
- Choose View > Append Column. Repeat this step until you have three columns in the view.
- Select the top row of the first column (Column1). This is the view column header.
- In the Properties view, click the View Column Header tab.
- In the Label field, change the default text to
Author. Do not change the column headings for the second and third columns. Your screen should now look like Figure 15.
Figure 15. View column data binding
- In the page editor, click the Column1 view column.
- In the Properties view, click the Data tab.
- In the View Query Information section, verify that Column1 is selected in the View
query column field, then click Edit. The Edit View Query Column window opens:
Figure 16. Edit View Query Column window
- In the Column name field, delete
Column1and typeAuthor. - Leave
Stringin the Data type field. - Select blogEntry.
- In the Data binding tree structure, select blogEntry/s_Author[xs:string].
- Click OK.
- With the Author column still selected, click on the View Column tab in the Properties view.
- On the right-hand side under Column Display, select Check box.
- In the page editor, select the second column view.
- In the Properties view, click the Data tab and then click Add. Your screen should look like Figure 17.
Figure 17. View column data binding
- Use the table below to complete the New View Query Column window, and then click
OK.
Field name Data Column name Subject Data type String Schemas blogEntry Data binding /blogEntry/s_Subject[xs:string]
- Repeat Steps 14 through 16 for the third view column, using the information in the table
below.
Field name Data Column name Date Data type Date Schemas blogEntry Data binding /blogEntry/s_Date [xs:date]
Change the labels for the Subject and Date columns, if they are not labeled properly.
- Click the Subject column header in the top row to give it focus.
- In the Properties view, click the View Column Header tab.
- In the Label field, type
Subject. - Select the Date column header in the top row to give it focus. Repeat Steps 1 through 3, but this time type
Datein the Label field.
To create a link to open the blog document:
- In the page editor, select the Subject column.
- In the Properties view, click on the View Column tab.
- On the right side of the view, put a check in the box for Show values in this column as links.
- For the Document open mode, select the Read-only radio button.
- Save and close the viewBlogEntry page.
Your screen should now look like Figure 18.
Figure 18. View column document open mode





