Custom Component Markup | Techila
1300
single,single-post,postid-1300,single-format-standard,ajax_updown_fade,page_not_loaded,,qode_grid_1300,footer_responsive_adv,hide_top_bar_on_mobile_header,qode-content-sidebar-responsive,qode-theme-ver-9.4.2,bridge,wpb-js-composer js-comp-ver-4.12,vc_responsive
 

Custom Component Markup

download

Custom Component Markup

All markup for a custom component is defined within an <apex:component> tag. This tag must be the top-level tag in a custom component definition

For a more complex example, you could use a custom component to create a form that is used across multiple Visualforce pages. Create a new custom component named recordDisplay and copy the following code:

 

Notice that the markup can be a combination of Visualforce and HTML tags, just like other Visualforce pages.

 

<apex:component controller=”Account”>

    <apex:attribute name=”record” description=”The type of record we are viewing.”

                    type=”Object” required=”true”/>

    <apex:pageBlock title=”Viewing {!record}”>  

        <apex:detail />

    </apex:pageBlock>

</apex:component>

 

Next, create a page called displayRecords and use the following code:

 

<apex:page StandardController=”Account”>

  <c:recordDisplay record=”Account” />

</apex:page>

 

Output of the above code is as follows:

 

http://www.techilaservices.com/techilla-oldsite/wp-content/uploads/2016/08/CustomComponentMarkup.png

 

http://www.techilaservices.com/techilla-oldsite/wp-content/uploads/2016/08/CustomComponentMarkup1.png

 

Courtesy: https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_comp_cust_elements_markup.htm

Author: techila

No Comments

Post A Comment