Learning XPages Part 19 : Another Repeat Another Table

So now that we have our second XPage created
lets add some content to it. We’ll start by opening the new custom control
that we created called content_Location and clear out the placeholder text.
Once that’s done we need to define the data source for the control. Select
the ‘Custom Control’ node in the outline view on the left of your screen
and go to the ‘Data’ properties tab. Create a new data source based on
the vw_People view that is in the sample database

A picture named M2

Now, just like the home page we will
drag in a repeat control and into the repeat control we will create a table
of two rows and six columns by dragging in a table control. Give the first
row of your table some headers and then select the repeat control to look
at it’s properties.

A picture named M3

Set the Collection Name and Index Name
just like before and then, just like the repeated table on the homepage
we need to drag in some computed field controls and set their values by
using JavaScript similar to rowData.getColumnValue("colname");
where colname is the name of the column in the view that we are using as
our data source. Next you move the repeat control inside the table and
change the table header row to <th> tags. I have also given my table
a styleClass of ‘phonebook’ so that it uses the same CSS as I created for
the homepage’s table.

A picture named M4

You can now save your custom control
and preview the ‘Location’ XPage and you will see a nice table listing
all the people in the database. Feel free to apply the alternating row
styles to the table just like we did for the homepage to give your application
a consistent look and feel.

A picture named M5

In the screenshot above you’ll notic
that the alternating row styles don’t seem to have worked however if you
examine the original view that the database is based on you’ll see that
it has a categorized column at the start of the view and the two red lines
I have drawn above are rows in the table where those empty categories are
showing. In the next part I’ll show you how to pass a variable on the URl
to restrict the repeat to a single category.

Advertisements
Tagged with: , , , ,
Posted in None
One comment on “Learning XPages Part 19 : Another Repeat Another Table
  1. Hi,there’s a small typo in the article that made me crazy I got the server error message:Error 500HTTP Web Server: Command Not Handled ExceptionWhen you write:’… set their values by using JavaScript similar to rowData.GetColumnValue(“colname”); …’Actually it is:’… rowData.getColumnValue(“colname”); … ‘No difference? ONLY the “get” lowercase… I almost got crazy It helped me a lot this forum entry about showing friendlier error messages:{ Link }Thanks again for your series.

    Like

Comments are closed.

Archives
%d bloggers like this: