Activity Forums Salesforce® Discussions What is the use of apex:facet in Salesforce Visualforce?

  • Ratnakar

    Member
    March 15, 2018 at 1:17 pm

    Hi kapil,

    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.

    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>

  • Archit

    Member
    March 16, 2018 at 10:21 am

    Hello Kapil,

    <apex:facet> a Visualforce Component that are use to display the specific part of parent component such as header and footer of <apex:dataTable>.

    Thanks!

Log In to reply.

Popular Salesforce Blogs

Popular Salesforce Videos