Detail Page Display Using ActionSupport

This scenario describes the usage of apex:actionsupport and apex:param. Here param is used to pass individual record ids within the vf page to display detail page.

Visualforce page:
<apex:page sidebar=”false” standardController=”DataLoadTest__c” recordSetVar=”records”>
<apex:form >
<apex:pageBlock >
<apex:pageBlockSection >
<apex:pageBlockTable value=”{!records}” var=”r”>
<apex:column headerValue=”Name”>
<apex:actionsupport event=”onclick” rerender=”out” status=”mystatus”>
{!r.Name}
<apex:param name=”rId” value=”{!r.Id}”/>
</apex:actionsupport>
</apex:column>
<apex:column headerValue=”City”>
{!r.City__c}
</apex:column>
<apex:column headerValue=”Country__c”>
{!r.Country__c}
</apex:column>
<apex:column headerValue=”phone”>
{!r.phone__c}
</apex:column>
</apex:pageBlockTable>
</apex:pageBlockSection>
</apex:pageBlock>
<apex:actionstatus id=”mystatus” startText=”loading……………..”>
<apex:facet name=”stop”>
<apex:outputpanel id=”out”>
<apex:detail subject=”{!$CurrentPage.parameters.rId}” relatedList=”false”/>
</apex:outputpanel>
</apex:facet>
</apex:actionstatus>
</apex:form>
</apex:page>

Detail page Display using CommandLink:

Visualforce Page:
<apex:page sidebar=”false” standardController=”DataLoadTest__c” recordSetVar=”records”>
<apex:form >
<apex:pageBlock >
<apex:pageBlockSection >
<apex:pageBlockTable value=”{!records}” var=”r”>
<apex:column headerValue=”Name”>
<apex:commandLink value=”{!r.Name}” rerender=”out” status=”mystatus”>
<apex:param name=”rId” value=”{!r.Id}”/>
</apex:commandLink>
</apex:column>
<apex:column headerValue=”City”>
{!r.City__c}
</apex:column>
<apex:column headerValue=”Country__c”>
{!r.Country__c}
</apex:column>
<apex:column headerValue=”phone”>
{!r.phone__c}
</apex:column>
</apex:pageBlockTable>
</apex:pageBlockSection>
</apex:pageBlock>
<apex:actionstatus id=”mystatus” startText=”loading……………..”>
<apex:facet name=”stop”>
<apex:outputpanel id=”out”>
<apex:detail subject=”{!$CurrentPage.parameters.rId}” relatedList=”false”/>
</apex:outputpanel>
</apex:facet>
</apex:actionstatus>
</apex:form>
</apex:page>