Tag name: <amc:column>
The immediate children of a Table component must all be
<amc:column>
components. Each visible Column
component creates a separate column in the Table.
Use "headerText" attribute on a Column to create the column header. The following example creates a two-column table with the column headers - "Firstname" and "Lastname":
<amc:table> <amc:column headerText="Firstname"> ... </amc:column> <amc:column headerText="Lastname"> ... </amc:column> </amc: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.
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:
<amc:table var="row" value="#{myBean.employees}"> <amc:column> <amc:outputText value="#{row.firstname}"/> </amc:column> <amc:column> <amc:outputText value="#{row.lastname}"/> </amc:column> </amc:table>
In order to make a Column sortable, set the "sortable" property to true and set "sortProperty" to the name of the model that this column will sort.
<amc:table var="row" value="#{periodicTable.tableData}" id="t1"> <amc:column headerText="Element Name" sortable="true" sortProperty="name" id="column1"> <amc:outputText value="#{row.name}" id="ot1"/> </amc:column> </amc:table>
Name | Type | Supports EL? | Description |
---|---|---|---|
align | String | Yes |
Specifies the alignment for this column. Valid values:
|
filterable | boolean | Yes | Specifies whether or not the column is filterable. The sortProperty attribute *must* be set on the column for it to be filterable. On Windows Mobile, a filterable column will have a filter field on the top of the column header. On BlackBerry smartphones, a contextual menu item is added to allow user to filter the data. |
headerBackgroundColor | String | Yes | Sets the color of a background of the column header to an RGB value (rgb(255,0,0)) or a hexadecimal number (#ff0000 or #f00). The default value is device-dependent. |
headerFontFamily | String | Yes |
Defines a prioritized list of font family names and/or generic family names for the column header. The client will use the first value it recognizes. Valid values:
|
headerFontSize | int | Yes | Specifies the size of a font in points for the column header text. |
headerFontStyle | String | Yes |
Specifies how the characters in text should be displayed for the column header. Valid values:
headerFontStyle="bold underline". |
headerForegroundColor | String | Yes | Specifies the color of the foreground of the column header text. The color value can be an RGB value (rgb(255,0,0)) or a hexadecimal number (#ff0000 or #f00). The default value is device-dependent. |
headerText | String | Yes | Specifies text to display in the header of the column. |
id | String | No |
Specifies the identifier for the component. The identifier must follow the following rules:
|
sortProperty | String | Yes | Specifies the property that is displayed by this column. This is the property that the framework uses to sort and filter the Table's data. |
sortable | boolean | Yes |
Specifies whether or not the column is sortable. On BlackBerry smartphones, this allows the end user to invoke sorting from the menu when the table is in either cell or component selection mode: a table-specific "Sort" menu item is automatically added to the displayed menu at the time when the Table component gains focus. On Windows Mobile devices, sorting can be invoked by clicking on the column header. The header of sortable columns contains arrows indicating which column is currently sorted and in which direction. Note: In order for a column to be sortable, the sortProperty attribute must be set to "true" and the underlying model must support sorting by this column's property. |
width | int | Yes | Specifies the width of the column. Can be entered in pixels or as a percentage of the table width. The default width is 100px. There is no auto sizing for columns. Set the width attribute to ensure the column is wide enough to accommodate the width of the contents. A percentage value should be entered as a number followed by the "%" symbol. A number will be interpreted as a pixel value (as will a number followed by the text "px"). |