Project Documentation

Summary

Tag name: <tr:column>
UIComponent class: org.apache.myfaces.trinidad.component.core.data.CoreColumn
Component type: org.apache.myfaces.trinidad.CoreColumn
Required Ancestor Tag: tr:columntr: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":

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

Formatting

The Column component supports the following attributes related to formatting:

align
The type of alignment to use for this column. This atribute controls left/start, right/end, or center justification of the column data.
width
The width of 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

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

Supported Client Events for Client Behaviors

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

Events

Type Phases Description
org.apache.myfaces.trinidad.event.AttributeChangeEventInvoke 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
footerthe node to render as this column's footer.
headerthe node to use to render this column's header.

Attributes

Name Type Supports EL? Description
alignStringYes 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".
attributeChangeListenerjavax.el.MethodExpressionOnly 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.
bindingorg.apache.myfaces.trinidad.component.core.data.CoreColumnOnly 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.
defaultSortOrderStringYes 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".
headerNoWrapbooleanYes Default Value: false

whether or not the column header should be allowed to wrap
headerTextStringYes 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.
idStringNo the identifier for the component. The identifier must follow a subset of the syntax allowed in HTML:
  • Must not be a zero-length String.
  • First character must be an ASCII letter (A-Za-z) or an underscore ('_').
  • Subsequent characters must be an ASCII letter or digit (A-Za-z0-9), an underscore ('_'), or a dash ('-').
inlineStyleStringYes the CSS styles to use for this component.
noWrapbooleanYes Default Value: false

whether or not the column contents should be allowed to wrap
onclickStringYes an onclick Javascript handler.
ondblclickStringYes an ondblclick Javascript handler.
onkeydownStringYes an onkeydown Javascript handler.
onkeypressStringYes an onkeypress Javascript handler.
onkeyupStringYes an onkeyup Javascript handler.
onmousedownStringYes an onmousedown Javascript handler.
onmousemoveStringYes an onmousemove Javascript handler.
onmouseoutStringYes an onmouseout Javascript handler.
onmouseoverStringYes an onmouseover Javascript handler.
onmouseupStringYes an onmouseup Javascript handler.
partialTriggersString[]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".

renderedbooleanYes 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.
rowHeaderbooleanYes Default Value: false

Whether or not this column is a row header column.
separateRowsbooleanYes 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.
shortDescStringYes The short description of the component. This text is commonly used by user agents to display tooltip help text.
sortPropertyStringYes 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.
sortStrengthStringYes 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".
sortablebooleanYes 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.

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