Define a list view

About this task

Define a list view by dragging the List View element onto the PCF canvas. You can place the element anywhere a green line appears. For example:



The id attribute is required; it identifies the panel so that it can be referenced by other PCF elements. The ID must be unique, and it must end with the text string LV.

A list view contains one or more rows, each containing one or more cells. The structure of the simplest one-row list view is illustrated below:



To define the rows and cells of the list view, use Row and one of the *Cell elements such as TextCell or DateCell. Each occurrence of Row starts a new row, and each *Cell creates a new column within the row. The following example creates a one-row, three-column list view:



The id attribute of a *Cell element is required. It must be unique within the list view, but does not need to be unique across all of PolicyCenter. The value attribute contains the Gosu expression that appears within the cell. In the previous example, the value of each cell is set to 10, 20, and 30, respectively. You can set other attributes of a *Cell to control formatting, sorting, and many other options.

This simple example demonstrates the basic structure of a list view. However, you will almost never use a list view with a fixed number of rows. The more useful list views iterate over a data set and dynamically create as many rows as necessary. This is illustrated in Iterate a list view over a data set.

A list view requires a toolbar so that there is a place to put the paging controls, as well as any buttons or other controls that are necessary.

You can define a list view in the following ways:

Standalone

You can define a list view in a standalone file, and then include it in other screens where needed. This approach is the most flexible, as it allows you to define a list view once and then reuse it multiple times.

For example, suppose you define a standalone list view called MyLV.

You can then include this list view in a screen with the PanelRef element:


PCF editor showing a file containing a PanelRef.

Set the def attribute of the Panel Ref to the name of the list view; in this example, that is MyLV.

Inline

If a list view is simple and used only once, you can define it inline as part of a screen. This approach often makes it easier to create and understand a screen definition, as all of its component elements can be defined all in one place. However, an inline list view appears only where it is defined, and cannot be reused in other screens.

The following example defines an inline list view in a screen: