Adding and configuring a data table
With the Data Table component, you can display data from a database or other data source in a table format.
There are several ways to add a data table to a Faces JSP file:
- Drag a Data Table component from the Faces Components drawer on the palette to a Faces JSP page, add columns to the table, add Faces components to the columns, and then bind data to the table and the components it contains. You can use the
Value field in various Properties views to bind data. This is the most difficult way to add a data table to a page.
- Drag a data object from the Data and Services drawer on the palette to a page. A wizard opens. This wizard allows you to add a data table to the page and bind it to data. Make sure to check the
Add data controls option in the wizard so that a data table is added to the page.
- Drag an existing data object from the Page Data view to the page. The "Insert Record List" wizard opens. This is the way that the following steps describe.
To automatically add a data table that is bound to an existing relational record list:
- Open a Faces JSP file.
- Open the Page Data View (
Window | Show view | Page Data).
- Drag an existing relational record list in the Page Data view to the Faces JSP file. The "Insert Record List" wizard opens.
Note: If you do not have an existing relational record list, right-click within the Page Data view and choose
New | Relational Record List. The "Add Relational Record List" wizard opens.
- Next to
Data control to create, select the type of data table you want to create. The default is a multi-column data table so that you have one row for each data entry.
- Under
Columns to display, check the columns you want to appear in the data table. You can also change the accessibility label and change the default control type (for example, you can change an input field to a combo box field).
- Click
Options for additional accessibility options.
- Click Finish. The data table is added to the page.
- To set additional properties for the data table:
- At the Properties view for the data table (dataTable), add a header and footer to the data table by checking
Show header and
Show footer. A header displays along the top of the data table and a footer along the bottom of the data table. Each contains a Panel Box component to which you can drag other Faces components. For example, you can drag an Output component onto the Panel Box component to give the data table a name.
- At the
Display option tab of the Properties view for the data table, you can set a way for users to page through the table if it contains a large number of records. For example, if you click
Add a Web style pager, a pager is created in the footer of the data table. The pager displays a series of page numbers with hyperlinks to the appropriate pages
- At the
Row actions tab of the Properties view for the data table, you can add actions that execute when a row on a table is clicked or add an action that executes on selected rows in a table.
Restriction: Absolute positioning and the scrolling feature can not be used in the same data table.
Related concepts