Sunday, June 22, 2014

How to use apex:facet in Visualforce Page?

How to use <apex:facet>  in Visualforce Page?

<apex:facet>:
A placeholder for content that is rendered in a specific part of the parent component, such as the header or footer of an < apex:dataTable >.

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. Consequently, the order in which a facet component is defined within the body of a parent component does not affect the appearence of the parent component.

This tag supports following attributes:
Attribute
Description
name
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".

Visualforce Example:

<apex:page standardController="Account">
     <apex:pageBlock title="Contacts">
         <apex:dataTable value="{!account.Contacts}" var="contact" cellPadding="4" border="1">
             <apex:column>
                 <apex:facet name="header">Name</apex:facet>
                         {!contact.Name}
             </apex:column>
             <apex:column>
                 <apex:facet name="header">Phone</apex:facet>
                         {!contact.Phone}
             </apex:column>
         </apex:dataTable>
     </apex:pageBlock>
 </apex:page>


save image









0 comments:

Post a Comment

 
| ,