Summary
Tag name:
<
af:column
>
UIComponent class:
oracle.adf.view.faces.component.core.data.CoreColumn
Component type:
oracle.adf.CoreColumn
The immediate children of a Table component must all be
<
af:column
>
components. Each visible ADF Column
component creates a separate column in the Table.
Use the "header" facet on a Column to create the column header.
The following example creates a two-column table with the column headers -
"Firstname" and "Lastname":
<af:table>
<af:column>
<f:facet name="header">
<af:outputText value="Firstname"/>
</f:facet>
...
</af:column>
<af:column>
<f:facet name="header">
<af:outputText value="Lastname"/>
</f:facet>
...
</af:column>
</af:table>
The child components of each Column display the data for each row in
that column. The Column does not create child components per row;
instead, each child is repeatedly rendered (stamped) once per
row. Because of this stamping behavior, only certain types of
components are supported as children inside a Column. Supported
components include all components with no behavior and most
components that implement the EditableValueHolder or ActionSource
interfaces.
As each row is stamped, the data for the current row ( see
getRowData()
on the Table)
is copied into an EL reachable property.
The name of this property is defined by the
var
property on the Table. Once the Table has completed rendering, this
property is removed (or reverted back to its previous value). In
the following example, the data for each row is placed under the EL
property "row". Each Column displays the data for each row by getting
further properties from the "row" property:
<af:table var="row" value="#{myBean.employees}">
<af:column>
<af:outputText value="#{row.firstname}"/>
</af:column>
<af:column>
af:outputText value="#{row.lastname}"/>
</af:column>
</af:table>
Formatting
The Column component supports the following attributes related to
formatting:
-
formatType
-
The type of formatting to use for this column. This
atribute controls left, right or center justification of the
column data.
-
gridVisible
-
Controls the display of a grid line on the left of the column.
-
width
-
The width of this column.
-
bandingShade
-
Determines what background color to use for this column.
-
noWrap
-
Controls whether long lines of text in the column data should
be wrapped.
-
headerNoWrap
-
Controls whether long lines of text in the column header should
be wrapped.
-
separateRows
-
Controls whether each child of this
column should be rendered in separate cells, or inside the same
cell.
Sorting
In order to make this Column sortable, set the "sortable"
property to true and set "sortProperty" to the name of the
model that this column will sort. Sorting can be programatically
turned on with the
setSortCritiera()
method on the\
table.
Column Groups
<
af:column
>
tags can be nested to produce
groups of columns. The header of a column group spans across
all the columns it contains. The following example creates
a column group that has the header "Name" and contains
two sub columns with headers "First" and "Last":
<af:table var="row" value="#{myBean.employees}">
<af:column>
<f:facet name="header">
<af:outputText value="Name"/>
</f:facet>
<af:column>
<f:facet name="header">
<af:outputText value="First"/>
</f:facet>
<af:outputText value="#{row.firstname}"/>
</af:column>
<af:column>
<f:facet name="header">
<af:outputText value="Last"/>
</f:facet>
af:outputText value="#{row.lastname}"/>
</af:column>
</af:column>
</af:table>
Example: