Oracle ADF Faces - af:column
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:


    

Supported Facets

Name Description
footer the node to render as this column's footer.
header the node to use to render this column's header.

Attributes
Ungrouped attributes
Name Type Supports EL? Description
attributeChangeListener javax.faces.el.MethodBinding Only EL a method reference to an attribute change listener
bandingShade String Yes the background color to use for this column. The legal values are "light" and "dark".
formatType String Yes the type of formatting to use for this column. The legal values are "text", "number" and "icon", which describe columns that display text, numbers and buttons, respectively. Text columns are left-justified, number columns are right-justified, and button columns are center-justified.
gridVisible boolean Yes whether or not to display a grid line before the column's content (to the left in a left-to-right locale).
headerNoWrap boolean Yes whether or not the column header should be allowed to wrap
headerText String Yes text to display in the header of the column. This is a convenience that generates output equivalent to adding a "header" facet containing an outputText.
noWrap boolean Yes whether or not the column contents should be allowed to wrap
partialTriggers String[ ] Yes the IDs of the components that should trigger a partial update. This component will listen on the trigger components. If one of the trigger components receives an event that will cause it to update in some way, this component will request to be updated too.
rowHeader boolean Yes Whether or not this column is a row header column.
separateRows boolean Yes whether or not the children of this column should be rendered on separate rows. Setting this attribute to true will cause each child to render in its own row. Setting this to false will cause all the children to be rendered in one cell, which will rowSpan across the rows of the Columns whose children are rendered on separat e rows. This attribute is not supported on the following agent types: phone, voice.
sortProperty String Yes The property that is displayed by this Column. This is the property that the framework might use to (for example) sort the Table's data.
sortable boolean Yes whether or not the column is sortable. A sortable column has a clickable header that (when clicked) sorts the table by that column's property. Note that in order for a column to be sortable, this attribute must be set to "true" and the underlying model must support sorting by this column's property. This column's "sortProperty" attribute must be set if sorting is desired.
width String Yes the preferred width of this column, e.g., "30%", "100px".
Core attributes
Name Type Supports EL? Description
binding oracle.adf.view.faces.component. core.data.CoreColumn Only EL a binding reference to store the component instance
id String No the identifier for the component. This must be a valid XML ID, and therefore may not contain whitespace or start with a number. Also, JSF requires that IDs must not contain any colons (":").
inlineStyle String Yes the inline CSS style for this element
rendered boolean Yes whether the bean is rendered. When set to false, no output will be delivered for this bean.
shortDesc String Yes the short description of the bean. This text is commonly used by user agents to display tooltip help text.
styleClass String Yes the CSS style class of the bean.
Javascript attributes
Name Type Supports EL? Description
onclick String Yes an onclick Javascript handler.
ondblclick String Yes an ondblclick Javascript handler.
onkeydown String Yes an onkeydown Javascript handler.
onkeypress String Yes an onkeypress Javascript handler.
onkeyup String Yes an onkeyup Javascript handler.
onmousedown String Yes an onmousedown Javascript handler.
onmousemove String Yes an onmousemove Javascript handler.
onmouseout String Yes an onmouseout Javascript handler.
onmouseover String Yes an onmouseover Javascript handler.
onmouseup String Yes an onmouseup Javascript handler.
Copyright © 2003-2006, Oracle Corporation. All Rights Reserved.

E-mail this page
Printer View Printer View
Oracle Is The Information Company About Oracle | Oracle RSS Feeds | Careers | Contact Us | Site Maps | Legal Notices | Terms of Use | Privacy