A common technique when using Ajax in Visualforce is to group and identify the region to be dynamically updated. The <apex:outputPanel> component is often used for this, together with an id attribute for identifying the region.
- Create a Visualforce page called Dynamic, using the following body:
<apex:page standardController="Account"> <apex:pageBlock title="{!account.name}"> <apex:outputPanel id="contactDetails"> <apex:detail subject="{!$CurrentPage.parameters.cid}" relatedList="false" title="false"/> </apex:outputPanel> </apex:pageBlock> </apex:page>
- Ensure that your Visualforce page is called with an identifier for a valid account.
Your Visualforce page won’t show much at all except for the account name. Note that the <apex:outputPanel> has been given an identifier named contactDetails. Also note that the <apex:detail> component has a subject attribute specified. This attribute is expected to be the identifier of the record whose details you want to display. The expression {! $CurrentPage.parameters.cid} returns the cid parameter passed to the page. Since you’re not yet passing in such a parameter, nothing is rendered.
No comments:
Post a Comment