Creating a list of records is as easy as typing up a single component.
- Modify your accountDisplayVisualforce page to look like this:
<apex:page standardController="Account"> <apex:detail/> </apex:page>
If you access your page with a valid account ID passed in as a parameter, as demonstrated in the previous tutorial (it will look something like this:https://na3.salesforce.com/apex/AccountDisplay?id=0018000000MDfn1), then you’ll see a lot of output. - The <apex:detail/> component displays the standard view page for a record. It shows related lists as well, such as contacts. You can switch these off by adding therelatedList="false" attribute. Try adding it, click Save, and spot the difference.
- You can show only a particular related list; such as the list of case records that are related to the account record you are viewing. Add the following tag:
<apex:relatedList list="Cases" />
Although these tags are very simple, they’re doing a lot of work for you—and relying on that standard controller to go and retrieve the data. Sometimes, however, you want more control over page layout.
No comments:
Post a Comment