You can modify your Visualforce page to display the detail information on the same page. You already know that you can use a single detail tag to bring up detail information, so you only have to learn how to summon that information to your current Visualforce page.
The outputLink component you used in the previous section simply created a link in your page that directed the user to another page. In order to get additional information to display on the same page, you must change the page specification a little bit.
The apex:command components, when activated by a user, submits the current page to the Force Platform server, and returns a new version of the page to the user.
Note
Submitting a page also submits, by default, any changes the user has made to data presented by the page. |
You already used this functionality with the Save button for the main Position portion of the page. The commandButton submitted the page to the Force Platform standard controller that executed the standard Save action for the record and returned an updated version of the page to the browser.
For this task, you use a commandLink without asking for a specific action on the Force Platform server.
You start by adding a detail component to your page.
The code for this version of your Visualforce page is:
<apex:page standardController="Position__c" id="thePage"> <apex:form > <apex:pageBlock> <apex:pageMessages></apex:pageMessages> <apex:pageBlockButtons location="bottom"> <apex:commandButton action="{!save}" value="Save"> </apex:commandButton> <apex:commandButton action="{!cancel}" value="Cancel"> </apex:commandButton> </apex:pageBlockButtons> <apex:pageBlockSection columns="1"> <apex:inputField value="{!Position__c.Department__c}"> </apex:inputField> <apex:inputField value="{!Position__c.Job_Description__c}"> </apex:inputField> </apex:pageBlockSection> </apex:pageBlock> <apex:pageBlock > <apex:pageblockSection> <apex:pageblockTable value="{!Position__c.Job_Application__r}" var="JA"> <apex:column headerValue="Candidate"> <apex:commandLink value="{!JA.Candidate__r.First_Name__c} {!JA.Candidate__r.Last_Name__c}"> <apex:param name="candidate" value="{!JA.Candidate__r.ID}"></apex:param> </apex:commandLink> </apex:column > <apex:column value="{!JA.Candidate_Qualified__c}"> </apex:column> </apex:pageblockTable> </apex:pageblockSection> </apex:pageBlock> </apex:form> <apex:detail subject="{!$CurrentPage.parameters.candidate}" title="false" id="candidateDetail"> </apex:detail> </apex:page>
Your Visualforce page is getting more and more robust. Your next task is to bring this page into the world of Web 2.0, with its wondrous AJAX capabilities.
18.117.11.247