function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Neha@SfdcNeha@Sfdc 

Example of using <apex:facet> tag

hi,

I have come through many examples where <apex:facet> tag is used to in <apex:column>..But i don't get it why to do so?? although we can display column heading using <apex:column> tag itself

Can anyone paste a code snippet for explaination..?

Thanks
Neha

Best Answer chosen by Neha@Sfdc
Ramesh KallooriRamesh Kalloori
Please go through the below link.

https://www.salesforce.com/us/developer/docs/pages/Content/pages_compref_additional_facet.htm

<apex:page standardController="Account">
    <apex:pageBlock >
        <apex:dataTable value="{!account}" var="a">
            <apex:facet name="caption"><h1>This is 
              {!account.name}</h1></apex:facet>
            <apex:facet name="footer"><p>Information 
              Accurate as of {!NOW()}</p></apex:facet>
            <apex:column >
                <apex:facet name="header">Name</apex:facet>
                <apex:outputText value="{!a.name}"/>
            </apex:column>
            
            <apex:column >
                <apex:facet name="header">Owner</apex:facet>
                <apex:outputText value="{!a.owner.name}"/>
            </apex:column>
        </apex:dataTable>
    </apex:pageBlock>        
</apex:page>

thanks,
Ramesh

All Answers

Ramesh KallooriRamesh Kalloori
Please go through the below link.

https://www.salesforce.com/us/developer/docs/pages/Content/pages_compref_additional_facet.htm

<apex:page standardController="Account">
    <apex:pageBlock >
        <apex:dataTable value="{!account}" var="a">
            <apex:facet name="caption"><h1>This is 
              {!account.name}</h1></apex:facet>
            <apex:facet name="footer"><p>Information 
              Accurate as of {!NOW()}</p></apex:facet>
            <apex:column >
                <apex:facet name="header">Name</apex:facet>
                <apex:outputText value="{!a.name}"/>
            </apex:column>
            
            <apex:column >
                <apex:facet name="header">Owner</apex:facet>
                <apex:outputText value="{!a.owner.name}"/>
            </apex:column>
        </apex:dataTable>
    </apex:pageBlock>        
</apex:page>

thanks,
Ramesh
This was selected as the best answer
Neha@SfdcNeha@Sfdc
hi ,
Thanks for the reply....So while using facet it depends on the attribute name of facet as to what we set..
for eg:if we set it as name="header"..then it will be considered as a column 2. if name="footer" then set the text at the footer...Am i going the right way?

Thanks,
Neha
Ramesh KallooriRamesh Kalloori
yes.

if the problem resolved make it as best answer it will useful to ther community members.

thanks,
Ramesh