Note: This release is in preview. Features described here don’t become generally available until the latest general availability date that Salesforce announces for this release. Before then, and where features are noted as beta, pilot, or developer preview, we can’t guarantee general availability within any particular time frame or at all. Make your purchase decisions only on the basis of generally available products and features.
apex:facet
A placeholder for content that's rendered in a specific part of the parent component, such as the header or footer of an <apex:dataTable>.
Use this component to get user input for a controller method that does not correspond to a field on an sObject. Only <apex:inputField> and <apex:outputField> can be used with sObject fields.
An <apex:facet> component can only exist in the body of a parent component if the parent supports facets. The name of the facet component must match one of the pre-defined facet names on the parent component. This name determines where the content of the facet component is rendered. The order in which a facet component is defined within the body of a parent component doesn't affect the appearance of the parent component.
See <apex:dataTable> for an example of facets.
Note: Although you can't represent an <apex:facet> directly in Apex, you can specify it on a dynamic component that has the facet. For example:
Component.apex.dataTable dt = new Component.apex.dataTable(); dt.facets.header = 'Header Facet';
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<!-- Shows a two column table of contacts associated with the account.
8The account column headers are controlled by the facets.-->
9
10<apex:page standardController="Account">
11 <apex:pageBlock title="Contacts">
12 <apex:dataTable value="{!account.Contacts}" var="contact" cellPadding="4" border="1">
13 <apex:column >
14 <apex:facet name="header">Name</apex:facet>
15 {!contact.Name}
16 </apex:column>
17 <apex:column >
18 <apex:facet name="header">Phone</apex:facet>
19 {!contact.Phone}
20 </apex:column>
21 </apex:dataTable>
22 </apex:pageBlock>
23</apex:page>Attributes
| Attribute Name | Attribute Type | Description | Required? | API Version | Access |
|---|---|---|---|---|---|
| name | String | The name of the facet to be rendered. This name must match one of the pre-defined facet names on the parent component and determines where the content of the facet component is rendered. For example, the dataTable component includes facets named "header", "footer", and "caption". | Yes | 10.0 | global |