apex:column

A single column in a table. An <apex:column> component must always be a child of an <apex:dataTable> or <apex:pageBlockTable> component.

Note that if you specify an sObject field as the value attribute for an <apex:column>, the associated label for that field is used as the column header by default. To override this behavior, use the headerValue attribute on the column, or the column’s header facet.

This component supports HTML pass-through attributes using the “html-” prefix. Pass-through attributes are attached to the generated <td> tag for the column in every row of the table.

Example 

1<!-- For this example to render properly, you must associate the Visualforce page
2with a valid account record in the URL.
3For example, if 001D000000IRt53 is the account ID, the resulting URL should be:
4https://MyDomain_login_URL/apex/myPage?id=001D000000IRt53
5See the Visualforce Developer's Guide Quick Start Tutorial for more information. -->
6
7<apex:page standardController="Account">
8    <apex:pageBlock title="My Content">
9        <apex:pageBlockTable value="{!account.Contacts}" var="item">
10            <apex:column value="{!item.name}"/>
11            <apex:column value="{!item.phone}"/>
12        </apex:pageBlockTable>
13    </apex:pageBlock>
14</apex:page>

Attributes 

Attribute NameAttribute TypeDescriptionRequired?API VersionAccess
breakBeforeBooleanA Boolean value that specifies whether the column should begin a new row in the table. If set to true, the column begins a new row. If not specified, this value defaults to false. 10.0global
colspanIntegerThe number of columns that this column spans in the table. Note that this value does not apply to the header and footer cells. 10.0global
dirStringThe direction in which text in the generated column should be read. Possible values include “RTL” (right to left) or “LTR” (left to right). Note that this value does not apply to the header and footer cells. 10.0global
footerClassStringThe style class used to display the column footer, if defined. This attribute is used primarily to designate which CSS styles are applied when using an external CSS stylesheet. 10.0global
footercolspanStringThis attribute was deprecated in Salesforce API version 16.0 and has no effect on the page. 10.0global
footerdirStringThis attribute was deprecated in Salesforce API version 16.0 and has no effect on the page. 10.0global
footerlangStringThis attribute was deprecated in Salesforce API version 16.0 and has no effect on the page. 10.0global
footeronclickStringThis attribute was deprecated in Salesforce API version 16.0 and has no effect on the page. 10.0global
footerondblclickStringThis attribute was deprecated in Salesforce API version 16.0 and has no effect on the page. 10.0global
footeronkeydownStringThis attribute was deprecated in Salesforce API version 16.0 and has no effect on the page. 10.0global
footeronkeypressStringThis attribute was deprecated in Salesforce API version 16.0 and has no effect on the page. 10.0global
footeronkeyupStringThis attribute was deprecated in Salesforce API version 16.0 and has no effect on the page. 10.0global
footeronmousedownStringThis attribute was deprecated in Salesforce API version 16.0 and has no effect on the page. 10.0global
footeronmousemoveStringThis attribute was deprecated in Salesforce API version 16.0 and has no effect on the page. 10.0global
footeronmouseoutStringThis attribute was deprecated in Salesforce API version 16.0 and has no effect on the page. 10.0global
footeronmouseoverStringThis attribute was deprecated in Salesforce API version 16.0 and has no effect on the page. 10.0global
footeronmouseupStringThis attribute was deprecated in Salesforce API version 16.0 and has no effect on the page. 10.0global
footerstyleStringThis attribute was deprecated in Salesforce API version 16.0 and has no effect on the page. 10.0global
footertitleStringThis attribute was deprecated in Salesforce API version 16.0 and has no effect on the page. 10.0global
footerValueStringThe text that should be displayed in the column footer. If you specify a value for this attribute, you cannot use the column’s footer facet. 12.0global
headerClassStringThe style class used to display the table header, if defined. This attribute is used primarily to designate which CSS styles are applied when using an external CSS stylesheet. 10.0global
headercolspanStringThe number of columns that the header column spans in the table, if defined. This attribute cannot be used in Visualforce page versions 16.0 and above. 10.0global
headerdirStringThis attribute was deprecated in Salesforce API version 16.0 and has no effect on the page. 10.0global
headerlangStringThis attribute was deprecated in Salesforce API version 16.0 and has no effect on the page. 10.0global
headeronclickStringThis attribute was deprecated in Salesforce API version 16.0 and has no effect on the page. 10.0global
headerondblclickStringThis attribute was deprecated in Salesforce API version 16.0 and has no effect on the page. 10.0global
headeronkeydownStringThis attribute was deprecated in Salesforce API version 16.0 and has no effect on the page. 10.0global
headeronkeypressStringThis attribute was deprecated in Salesforce API version 16.0 and has no effect on the page. 10.0global
headeronkeyupStringThis attribute was deprecated in Salesforce API version 16.0 and has no effect on the page. 10.0global
headeronmousedownStringThis attribute was deprecated in Salesforce API version 16.0 and has no effect on the page. 10.0global
headeronmousemoveStringThis attribute was deprecated in Salesforce API version 16.0 and has no effect on the page. 10.0global
headeronmouseoutStringThis attribute was deprecated in Salesforce API version 16.0 and has no effect on the page. 10.0global
headeronmouseoverStringThis attribute was deprecated in Salesforce API version 16.0 and has no effect on the page. 10.0global
headeronmouseupStringThis attribute was deprecated in Salesforce API version 16.0 and has no effect on the page. 10.0global
headerstyleStringThis attribute was deprecated in Salesforce API version 16.0 and has no effect on the page. 10.0global
headertitleStringThis attribute was deprecated in Salesforce API version 16.0 and has no effect on the page. 10.0global
headerValueStringThe text that should be displayed in the column header. If you specify a value for this attribute, you cannot use the column’s header facet. Note also that specifying a value for this attribute overrides the default header label that appears if you use an inputField or outputField in the column body. 12.0global
idStringAn identifier that allows the column component to be referenced by other components in the page. 10.0global
langStringThe base language for the generated HTML output, for example, “en” or “en-US”. For more information on this attribute, see the W3C specifications. 10.0global
onclickStringThe JavaScript invoked if the onclick event occurs in the column –that is, if the column is clicked. Note that this value does not apply to the header and footer cells. 10.0global
ondblclickStringThe JavaScript invoked if the ondblclick event occurs in the column–that is, if the column is clicked twice. Note that this value does not apply to the header and footer cells. 10.0global
onkeydownStringThe JavaScript invoked if the onkeydown event occurs in the column –that is, if the user presses a keyboard key. Note that this value does not apply to the header and footer cells. 10.0global
onkeypressStringThe JavaScript invoked if the onkeypress event occurs in the column–that is, if the user presses or holds down a keyboard key. Note that this value does not apply to the header and footer cells. 10.0global
onkeyupStringThe JavaScript invoked if the onkeyup event occurs in the column–that is, if the user releases a keyboard key. Note that this value does not apply to the header and footer cells. 10.0global
onmousedownStringThe JavaScript invoked if the onmousedown event occurs in the column–that is, if the user clicks a mouse button. Note that this value does not apply to the header and footer cells. 10.0global
onmousemoveStringThe JavaScript invoked if the onmousemove event occurs in the column–that is, if the user moves the mouse pointer. Note that this value does not apply to the header and footer cells. 10.0global
onmouseoutStringThe JavaScript invoked if the onmouseout event occurs in the column–that is, if the user moves the mouse pointer away from the column. Note that this value does not apply to the header and footer cells. 10.0global
onmouseoverStringThe JavaScript invoked if the onmouseover event occurs in the column–that is, if the user moves the mouse pointer over the column. Note that this value does not apply to the header and footer cells. 10.0global
onmouseupStringThe JavaScript invoked if the onmouseup event occurs in the column–that is, if the user releases the mouse button. Note that this value does not apply to the header and footer cells. 10.0global
renderedBooleanA Boolean value that specifies whether the component is rendered on the page. If not specified, this value defaults to true. 10.0global
rowspanIntegerThe number of rows that each cell of this column takes up in the table. 10.0global
styleStringThe style used to display the column, used primarily for adding inline CSS styles. Note that this value does not apply to the header and footer cells. 10.0global
styleClassStringThe style class used to display the column, used primarily to designate which CSS styles are applied when using an external CSS stylesheet. Note that this value does not apply to the header and footer cells. 10.0global
titleStringThe text to display as a tooltip when the user’s mouse pointer hovers over this component. 10.0global
valueStringThe text that should be displayed in every cell of the column, other than its header and footer cells. If you specify a value for this attribute, you cannot add any content between the column’s opening and closing tags. 12.0global
widthStringThe width of the column in pixels (px) or percentage (%). If not specified, this value defaults to 100 pixels. 10.0global

Facets 

Facet NameDescriptionAPI Version
footerThe components that appear in the footer cell for the column. Note that the order in which a footer facet appears in the body of a column component does not matter, because any facet with name=“footer” will control the appearance of the final cell in the column. If you use a footer facet, you cannot specify a value for the column’s footerValue attribute.10.0
headerThe components that appear in the header cell for the column. Note that the order in which a header facet appears in the body of a column component does not matter, because any facet with name=“header” will control the appearance of the first cell in the column. If you use a header facet, you cannot specify a value for the column’s headerValue attribute. Note also that specifying a value for this facet overrides the default header label that appears if you use an inputField or outputField in the column body.10.0

See Also