Columns and Column Data

Using Tables and Trees 10-15 header sort the content in the reverse order. In order for the table to be able to sort, the underlying data model must also support sorting. For more information, see Section 10.2.7, What You May Need to Know About Programmatically Enabling Sorting for Table Columns. ■ Content alignment: You can align the content within the column to either the start, end, left, right, or center using the align attribute. ■ Column width: The width of a column can be specified as an absolute value in pixels using the width attribute. If you configure a column to allow stretching, then you can also set the width as a percentage. ■ Line wrapping: You can define whether or not the content in a column can wrap over lines, using the noWrap attribute. By default, content will not wrap. ■ Row headers: You can define the left-most column to be a row header using the rowHeader attribute. When you do so, the left-most column is rendered with the same look as the column headers, and will not scroll off the page. Figure 10–12 shows how a table showing departments appears if the first column is configured to be a row header. Figure 10–12 Row Header in a Table If you elect to use a row header column and you configure your table to allow row selection, the row header column displays a selection arrow when a users hovers over the row, as shown in Figure 10–13 . Figure 10–13 Selection Icon in Row Header For tables that allow multiple selection, users can mouse down and then drag on the row header to select a contiguous blocks of rows. The table will also autoscroll vertically as the user drags up or down. Tip: Use start and end instead of left and right if your application supports multiple reading directions. 10-16 Web User Interface Developers Guide for Oracle Application Development Framework

10.2.4 How to Display a Table on a Page

You use the Create an ADF Faces Table dialog to add a table to a JSF page. You also use this dialog to add column components for each column you need for the table. You can also bind the table to the underlying model or bean using EL expressions. Once you complete the dialog, and the table and columns are added to the page, you can use the Property Inspector to configure additional attributes of the table or columns, and add listeners to respond to table events. You must have an implementation of the CollectionModel class to which your table will be bound. To display a table on a page: 1. In the Component Palette, from the Common Components panel, drag and drop a Table to open the Create ADF Faces Table dialog. Use the dialog to bind the table to any existing model you have. When you bind the table to a valid model, the dialog automatically shows the columns that will be created. You can then use the dialog to edit the values for the columns’ header and value attributes, and choose the type of component that will be used to display the data. Alternatively, you can manually configure columns and bind at a later date. For more information about using the dialog, press F1 or click Help. 2. In the Property Inspector, expand the Common section. If you have already bound your table to a model, the value attribute should be set. You can use this section to set the following table-specific attributes: ■ RowSelection : Set a value to make the rows selectable. Valid values are: none, single, and multiple, and multipleNoSelectAll. For information about how to then programatically perform some action on the selected rows, see Section 10.2.8, What You May Need to Know About Performing an Action on Selected Rows in Tables. ■ ColumnSelection : Set a value to make the columns selectable. Valid values are: none, single, and multiple. Tip: While the user can change the way the table displays at runtime for example the user can reorder columns or change column widths, those values will not be retained once the user leaves the page unless you configure your application to allow user customization. For information, see Chapter 31, Allowing User Customization on JSF Pages. Note: If your application uses the Fusion technology stack, then you can use data controls to create tables and the binding will be done for you. For more information see the Creating ADF Databound Tables chapter of the Oracle Fusion Middleware Web User Interface Developers Guide for Oracle Application Development Framework. Note: Users can select all rows and all columns in a table by clicking the column header for the row header if the rowSelection attribute is set to multiple and that table also contains a row header. If you do not want users to be able to select all columns and rows, then set rowSelection to multipleNoSelectAll.