Skip Headers

Oracle® Application Development Framework Developer's Guide 10g Release 3 (10.1.3) B25386-01 |
| Home | Solution Area | Contents | Index

Previous | Next |

# 7.4 Modifying the Attributes Displayed in the Table

Once you use the Data Control Palette to create a table, you can then delete attributes, change the order in which they are displayed, change the component used to display them, and change the attribute binding for the component.

## 7.4.1 How to Modify the Displayed Attributes

You can modify the following aspects of a table that was created using the Data Control Palette.

- Change the binding for the label of a column

- Change the attribute to which UI component is bound

- Change the UI component bound to an attribute

- Reorder the columns in the table

- Delete a column in a table

- Add a column to a table

To change the attributes for a table:

1. In the Structure window, right-click the Table tag and choose Edit Columns.

2. In the Edit Columns dialog, you can do the following:

   - Change the label for the column. By default, the label is bound to the `label` property of the table binding. For more information about this property, see Appendix B, "Reference ADF Binding Properties". This binding allows you to change the label once and have it appear the same on all pages that display the label. In this dialog, you can instead enter text or an EL expression to bind the label value to something else, for example, a key in a resource file.

     For example, the headings for the status columns in the table on the SRList page are bound to the label property of the status attribute binding:

         #{bindings.findServiceRequests1.labels.status}

     However, you could change it to instead be bound to a key in a properties file, for example:

         #{srlist['sr.status']}

     In this example, `srlist` would be a variable defined in the JSF page used to load a properties file. For more information about using resource bundles, see Section 14.4, "Internationalizing Your Application".

   - Change the attribute binding for the column.

     For example, you can change the status column to instead be bound to the `requestDate` attribute. Note the following:

     - If you change the binding, the label for the column also changes.

     - If you change the binding to an attribute currently bound to another column, the UI component changes to a component different from that used for the column currently bound to that attribute.

     If you simply want to rearrange the columns, you should use the order buttons. See the fourth bullet point below for more information.

   - Change the UI component used to display the attribute. The UI components are either `inputText` or `outputText` and are set based on the widget you selected when you dropped the collection onto the page. You can change to the other component using the dropdown menu. If you want to use a different component, such as a command link or button, you need to use this dialog to change to an `outputText` component, and then in the Structure window, add that other UI component (such as a command link) as a parent to this component.

     Tip: You can use the following UI components in a table with the noted caveats: The `selectBooleanCheckbox` component can be used inside a table if it is only handling `boolean` or `java.lang.Beoolean` types. The `selectOneList/Choice/Radio` components can be used inside the table if you manually add the list of choices as an enumeration. If instead you want to use a list binding, then the `selectOne` UI component cannot be used inside a table. For more information on list bindings, see Section 11.7, "Creating Databound Dropdown Lists".

   - Change the order of the columns using the order buttons. Top moves the column to the first column at the left of the table. Up moves the column one column to the left. Down moves the column one to the right. Bottom moves the column to the very right.

   - Add a column using the New button. Doing so adds a new column at the bottom of the dialog and populates it by default with values from the next sequential attribute in the collection. You then need to edit the values. You can only select an attribute associated with the object to which the table is bound.

   - Delete a column using the Delete button. Doing so deletes the column from the table.

   - Add a `tableSelectOne` component to the table's `selection` facet by selecting Enable selection. For more information, see Section 7.6, "Enable Row Selection in a Table".

   - Add sorting capabilities by selecting Enable sorting.

     Note: If you choose to enable sorting, the table can only sort through the number of objects returned by the iterator, as determined by the iterators `rangeSize` attribute.

## 7.4.2 Changing the Binding for a Table

Instead of modifying a binding, you can completely change the object to which the table is bound.

To rebind a table:

1. Right-click the table or other UI component in the Structure window and choose Edit Binding to launch the Table Binding Editor.

2. In the editor, select the new collection to which you want to bind the table. Note that changing the binding for the table will also change the binding for all the columns. You can then use the procedures in Section 7.4.1, "How to Modify the Displayed Attributes" to modify those bindings.

## 7.4.3 What Happens When You Modify Bindings or Display of Attributes

When you simply modify how an attribute is displayed, by moving the UI component or changing the UI component, JDeveloper changes the corresponding code on the JSF page. When you use the Binding Editors to add or change a binding, JDeveloper adds the code to the JSF page, and also adds the appropriate elements to the page definition file.