Parent Project
Project Documentation


Tag Name: <tr:column>
Java Class:
Component Type: org.apache.myfaces.trinidad.CoreColumn
Required Ancestor Tag(s): tr:column, tr:table, tr:treeTable
The immediate children of a Table component must all be <tr:column> components. Each visible Trinidad 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":
      <f:facet name="header">
        <tr:outputText value="Firstname"/>
      <f:facet name="header">
        <tr:outputText value="Lastname"/>
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:
  <tr:table var="row" value="#{myBean.employees}">
      <tr:outputText value="#{row.firstname}"/>
      tr:outputText value="#{row.lastname}"/>


The Column component supports the following attributes related to formatting:

The type of alignment to use for this column. This atribute controls left/start, right/end, or center justification of the column data.
The width of this column.
Controls whether long lines of text in the column data should be wrapped.
Controls whether long lines of text in the column header should be wrapped.
Controls whether each child of this column should be rendered in separate cells, or inside the same cell.


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

<tr: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":
  <tr:table var="row" value="#{myBean.employees}">
      <f:facet name="header">
        <tr:outputText value="Name"/>
        <f:facet name="header">
          <tr:outputText value="First"/>
        <tr:outputText value="#{row.firstname}"/>
        <f:facet name="header">
          <tr:outputText value="Last"/>
        tr:outputText value="#{row.lastname}"/>

Supported Client Events for Client Behaviors

  • click (default)
  • dblclick
  • keydown
  • keypress
  • keyup
  • mousedown
  • mousemove
  • mouseout
  • mouseover
  • mouseup


Type Phases Description
org.apache.myfaces.trinidad.event.AttributeChangeEvent Invoke Application,
Apply Request Values
Event delivered to describe an attribute change. Attribute change events are not delivered for any programmatic change to a property. They are only delivered when a renderer changes a property without the application's specific request. An example of an attribute change event might include the width of a column that supported client-side resizing.

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.


Name Type Supports EL? Description
align String Yes Valid Values: start, end, center, left, right
Default Value: start

The alignment for this column. The legal values are "start", "end" and "center", for left-justified, right-justified, and center-justified respectively in LTR display. The default value is "start".
attributeChangeListener javax.el.MethodExpression Only EL a method reference to an attribute change listener. Attribute change events are not delivered for any programmatic change to a property. They are only delivered when a renderer changes a property without the application's specific request. An example of an attribute change events might include the width of a column that supported client-side resizing.
binding Only EL an EL reference that will store the component instance on a bean. This can be used to give programmatic access to a component from a backing bean, or to move creation of the component to a backing bean.
defaultSortOrder String Yes Valid Values: ascending, descending
Default Value: ascending

The default sort order of the column. The legal values are "ascending" or "descending" for ascending sorting or descending sorting on a first click respectively. The default value is "ascending".
headerNoWrap boolean Yes Default Value: false

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.
id String No the identifier for the component. Every component may be named by a component identifier that must conform to the following rules:
  • They must start with a letter (as defined by the Character.isLetter() method) or underscore ( _ ).
  • Subsequent characters must be letters (as defined by the Character.isLetter() method), digits as defined by the Character.isDigit() method, dashes ( - ), or underscores ( _ ). To minimize the size of responses generated by JavaServer Faces, it is recommended that component identifiers be as short as possible. If a component has been given an identifier, it must be unique in the namespace of the closest ancestor to that component that is a NamingContainer (if any).
inlineStyle String Yes the CSS styles to use for this component.
noWrap boolean Yes Default Value: false

whether or not the column contents should be allowed to wrap
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.
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.

Separate multiple triggers with a space. e.g., partialTriggers="cmp1 cmp2"

Identifiers must account for NamingContainers. You can use a single colon to start the search from the root, or use multiple colons to move up through the NamingContainer. For example, "::" will pop out of this component's naming container (it pops out of itself if it is a naming container), ":::" will pop out of two naming containers, etc. The search for the partialTrigger begins from there. e.g., partialTriggers=":::commandButton1" the search begins for the component with id = commandButton1 after popping out of two naming containers relative to this component. To go into naming containers, you separate the naming containers with ':', e.g.,partialTriggers= "nc1:nc2:nc3:componentId".

rendered boolean Yes Default Value: true

whether the component is rendered. When set to false, no output will be delivered for this component (the component will not in any way be rendered, and cannot be made visible on the client). If you want to change a component's rendered attribute from false to true using PPR, set the partialTrigger attribute of its parent component so the parent refreshes and in turn will render this component.
rowHeader boolean Yes Default Value: false

Whether or not this column is a row header column.
separateRows boolean Yes Default Value: false

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 separate rows.
shortDesc String Yes The short description of the component. This text is commonly used by user agents to display tooltip help text.
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.
sortStrength String Yes Valid Values: Primary, Secondary, Tertiary, Identical
Default Value: Identical

The sorting strength for this column. It controls how this column should be sorted, what level of difference considered significant during comparison. Currently the values supported are: "Primary", "Secondary", "Tertiary" and "Identical". Default value is "Identical".
sortable boolean Yes Default Value: false

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.

styleClass String Yes a CSS style class to use for this component.
width String Yes the preferred width of this column, e.g., "30%", "100px".