Formatting Columns Displaying Data in Tables

Using Tables and Trees 10-17 3. Expand the Columns section. If you previously bound your table using the Create ADF Faces Table dialog, then these settings should be complete. You can use this section to change the binding for the table, to change the variable name used to access data for each row, and to change the display label and components used for each column. 4. Expand the Appearance section. You use this section to set the appearance of the table, by setting the following table-specific attributes: ■ Width : Specify the width of the table. You can specify the width as either a percentage or as a number of pixels. The default setting is 300 pixels. If you configure the table to stretch columns using the columnStretching attribute, you must set the width to percentages. ■ ColumnStretching : If the widths of the columns do not together fill the whole table, you can set this attribute to determine whether or not to stretch columns to fill up the space, and if so, which columns should stretch. Tip: If you want to use a component other than those listed, select any component in the Property Inspector, and then manually change it: 1. In the Structure window, right-click the component created by the dialog. 2. Choose Convert from the context menu. 3. Select the desired component from the list. You can then use the Property Inspector to configure the new component. Tip: If you want more than one component to be displayed in a column, add the other component manually and then wrap them both in a panelGroupLayout component. To do so: 1. In the Structure window, right-click the first component and choose Insert before or Insert after. Select the component to insert. 2. By default the components will be displayed vertically. To have multiple components displayed next to each other in one column, press the shift key and select both components in the Structure window. Right-click the selection and choose Surround With. 3. Select panelGroupLayout. Tip: If the table is a child to a component that stretches its children, then this width setting will be overridden and the table will automatically stretch to fit its container. For more information about how components stretch, see Section 8.2.1, Geometry Management and Component Stretching. Note: If the table is placed inside a component that can stretch its children, only the table will stretch automatically. You must manually configure column stretching if you want the columns to stretch to fill the table. Note: Columns configured to be row headers or configured to be frozen will not be stretched because doing so could easily leave the user unable to access the scrollable body of the table. 10-18 Web User Interface Developers Guide for Oracle Application Development Framework You can set column stretching to one of the following values: – blank: If you want to have an empty blank column automatically inserted and have it stretch so the row background colors will span the entire width of the table. – A specifically named column: Any column currently in the table can be selected to be the column to stretch. – last: If you want the last column to stretch to fill up any unused space inside of the window. – none: The default option where nothing will be stretched. Use this for optimal performance. – multiple: All columns that have a percentage value set for their width attribute will be stretched to that percent, once other columns have been rendered to their non-stretched width. The percentage values will be weighted with the total. For example, if you set the width attribute on three columns to 50, each column will get 13 of the remaining space after all other columns have been rendered. ■ HorizontalGridVisible : Specify whether or not the horizontal grid lines are to be drawn. ■ VerticalGridVisible : Specify whether or not the vertical grid lines are to be drawn. ■ RowBandingInterval : Specify how many consecutive rows form a row group for the purposes of color banding. By default, this is set to 0, which displays all rows with the same background color. Set this to 1 if you want to alternate colors. ■ ColumnBandingInterval : Specify the interval between which the column banding occurs. This value controls the display of the column banding in the table. For example, columnBandingInterval=1 would display alternately banded columns in the table. ■ FilterVisible : You can add a filter to the table so that it displays only those rows that match the entered filter criteria. If you configure the table to allow filtering, you can set the filter to be case-insensitive or case-sensitive. For more information, see Section 10.4, Enabling Filtering in Tables. ■ Text attributes: You can define text strings that will determine the text displayed when no rows can be displayed, as well as a table summary and description for accessibility purposes. 5. Expand the Behavior section. You use this section to configure the behavior of the table by setting the following table-specific attributes: Performance Tip: Column stretching is turned off by default. Turning on this feature may have a performance impact on the client rendering time for complex tables. Tip: While the user can change the values of the column width at runtime, those values will not be retained once the user leaves the page unless you configure your application to use change persistence. For information about enabling and using change persistence, see Chapter 31, Allowing User Customization on JSF Pages. Using Tables and Trees 10-19 ■ DisableColumnReordering : By default, columns can be reordered at runtime using a menu option contained by default in the panelCollection component. You can change this so that users will not be able to change the order of columns. The panelCollection component provides default menus and toolbar buttons for tables, trees, and tree tables. For more information, see Section 10.8, Displaying Table Menus, Toolbars, and Status Bars . ■ FetchSize : Set the size of the block that should be returned with each data fetch. The default is 25. ■ ContentDelivery : Specify when the data should be delivered. When the contentDelivery attribute is set to immediate, data is fetched at the same time the component is rendered. If the contentDelivery attribute is set to lazy, data will be fetched and delivered to the client during a subsequent request. If the attribute is set to whenAvailable the default, the renderer checks if the data is available. If it is, the content is delivered immediately. If it is not, then lazy delivery is used. For more information, see Section 10.1.1, Content Delivery. ■ AutoHeightRows : If you want your table to size the height automatically to fill up available space, specify the maximum number of rows that the table should display. The default value is -1 no automatic sizing for any number of rows. You can also set the value to 0 to have the value be the same as the fetchSize. Note: While the user can change the order of columns, 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. Tip: You should determine the value of the fetchSize attribute by taking the height of the table and dividing it by the height of each row to determine how many rows will be needed to fill the table. If the fetchSize attribute is set too low, it will require multiple trips to the server to fill the table. If it is set too high, the server will need to fetch more rows from the data source than needed, thereby increasing time and memory usage. On the client side, it will take longer to process those rows and attach them to the component. For more information, see Section 10.1.1, Content Delivery. Note: Note the following about setting the autoHeightRows attribute: ■ Specifying height on the inlineStyle attribute will have no effect and will be overridden by the value of AutoHeightRows. ■ Specifying a min-height or max-height on the inlineStyle attribute is not recommended and is incompatible with the autoHeightRows attribute. ■ When the component is placed in a layout-managing container, such as panelSplitter, it will be sized by the container no auto-sizing will occur. For more information, see Section 8.2.1, Geometry Management and Component Stretching.