« XPages in Pictures - 04 - Saving an XPage and Misc. | Main| XPages in Pictures - 06 - Creating Response Documents »

XPages in Pictures - 05 - Adding a Company View

Category XPages
This is the Fifth article in the XPages in Pictures Series.

In the last article, we created a home page called “xMain” to be the initial page of the application.  It has a “New Company” button on it, but nothing else.  Today you’re going to add a view of all our saved companies to this page.  You’ll also create links to the companies in the view so they can be edited. Finally, you’ll see how to associate a Notes Form with an XPage.

Adding a “Companies View” to the xMain page.

Ok, you’ve created some company documents but now you want to display them. You’re going to use a “View Control” to display the view directly on the “xMain” page.  Open up the “xMain” page and locate the View Control that lives in the Container Controls section.

A picture named M2

Now Drag this onto your page.  You’ll be presented with a popup box.

  A picture named M3

Set the view to “vCompanies” and click OK.  Don’t worry about anything else right now.

Now save and preview xMain in your browser and you have a nice list of any companies you’ve created.  

A picture named M4

Notice how there is already a Pager in the top right corner of the view?  No programming needed!!  In Designer, you can click on the pager control and change the style if needed.  You can even create a custom style.

Adding Links to the View.

Now we want to create links so we can return to the company.  We’ll put them in the first view column.  Click in the name column of the view. Click in the column itself, not the header.

A picture named M5

Then in the properties of that column click on “Show values in this column as links”.

A picture named M6


Now if you were to save this and preview xMain, you’ll see that your view has links for the company names and none of them work.

What we need to do is tell XPages how to open the link.  There are two ways to do this.  The first is in the view control itself.  If you select the view control, by clicking one of the sides in the overall “Box”…

A picture named M7
You’ll be able to get to a property of the view control that let’s you set what XPage to use when opening the document.



A picture named M8

If you were to select “xCompany” here, your links would now work correctly but you’d have to remember to do this in the future if you used additional view controls.  So for now, leave this set to “The document’s default form or page.”

Go into the properties of the traditional Notes Form.  On the second, beanie tab, there’s a new option for displaying an XPage on Web Access.

A picture named M9

Choose xCompany and save the form.

Now go back to your browser and look at xMain again.  Clicking on the linked company name brings up the company document in an XPage.  You can make changes to everything except the computed when composed “Unique” field.  Clicking the save button brings you back to the main page.

In this article we’ve added a View Control to the page and bound it to data.  We’ve taken a column of that view and turned it into links that open the correct company.  Our application now allows use to create, view, save and edit company documents. We even have a pager to assist in navigating the contacts view.

Not a bad start for doing no real coding whatsoever yet.



Comments

Gravatar Image1 - Thanks for this...really helped me a lot..

Post A Comment

:-D:-o:-p:-x:-(:-):-\:angry::cool::cry::emb::grin::huh::laugh::lips::rolleyes:;-)

Powered By:

Domino BlogSphere
Version 3.0.2