Search Here

apex: detail Component in Visualforce Page

 The <apex: detail> is another important component, i.e., a standard detail page for an Object, as defined by the associated page layout for the Object in the setup.


The component contains attributes for


The associated related lists.

Related list hover-links.

Title bar(appear in the SF application interface)

Note: There is no need to wrap this component inside the <apex: form> element, as it already provides the <form> element.

The <apex: detail> component has the following attributes:


1. id


The id is a string-type attribute, i.e., a unique identifier that allows the detail component to be referenced by other components on the page.


Syntax


<apex: detail id="detailId"></apex: detail>  

2. inlineEdit


The inlineEdit is a Boolean-type attribute used to control whether the component supports inline editing.


Syntax


<apex: detail id="detailId" inlineEdit="true"></apex: detail>  

3. oncomplete


The oncomplete is a string-type attribute used to invoke the JavaScript method when:


The oncomplete event occurs.

The tab has been selected.

The content rendered on the page.

The oncomplete attribute works only when the inlineEdit or showChatter attributes are true.


Syntax


<apex: detail id="detailId" inlineEdit="true" oncomplete="apexMethod();"></apex: detail>  

4. relatedList


The relatedList is a Boolean-type attribute used to specify whether the related lists are included in the rendered component. The boolean value true is set as a default value to this attribute.


Syntax


<apex: detail id="detailId" relatedList="false"></apex: detail>  

5. relatedListHover

AD


The relatedListHover is a Boolean-type attribute used to specify whether or not the related list hover links are included in the rendered component. The boolean value true is set as a default value to this attribute.


Syntax


<apex: detail id="detailId" relatedListHover="false"></apex: detail>  

6. rendered


The rendered is a Boolean-type attribute used to specify whether or not this component is rendered on the page. The boolean value true is set as a default value to this attribute.


Syntax

AD


<apex: detail id="detailId" rendered="false"></apex: detail>  

7. rerender


The rerender is an Object-type attribute used to specify the Id of one or more components that needs to be redrawn when the result of an AJAX update request completes on the client. The boolean value true is set as a default value to this attribute.


Syntax


<apex: detail id="detailId" rerender="Id1, Id2, Id3....."></apex: detail>  

8. showChatter


The showChatter is a Boolean-type attribute used to specify whether to display the Chatter information and controls for the record.


Syntax


<apex: detail id="detailId" showChatter="true"></apex: detail>  

9. subject


The showChatter is a string-type attribute used to specify the record's ID that should provide data for this component.


Syntax


<apex: detail id="detailId" subject="dataId"></apex: detail>  

10. title


The title is a Boolean-type attribute used to specify whether the title bar is included in the rendered page. The boolean value true is set as a default value to this attribute.


Syntax


<apex: detail id="detailId" title="true"></apex: detail>  

Let's take an example to understand how we can use the <apex: detail> component on the VF page:


ApexDetailExample.vfp


<!-- create the <apex: page> component with Account standard controller-->  

<apex: page standardController="Account">  

    <!-- pageBlock for displaying user information-->  

    <apex:pageBlock title="Hello {!$User.FirstName}!">  

        Displaying Account Information  

    </apex:pageBlock>  

      

    <!-- pageBlock for displaying Account information-->  

    <apex:pageBlock title="Account" >  

        <apex: form>             

            <apex:inputText  value="{!Account.id}"></apex:inputText>  

            <apex:commandLink value="click Here"></apex:commandLink>  

        </apex: form>  

        <!-- apex detail for showing account data-->  

        <apex:detail inlineEdit="true" subject="{!Account.id}"  relatedList="false" title="false"/>  

    </apex:pageBlock>  

</apex: page>  



Post a Comment

0 Comments
* Please Don't Spam Here. All the Comments are Reviewed by Admin.