Detail Page display using Command:link

<apex:param> is the child of <apex:commandLink>. Passing the record ID in the value of the param component and fetching it by currentPage.parameters.rId.


Here we have a visualforce page fetching the records by using a standardcontroller. On click of the commandlink,  the detail page of the record would be displayed.


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>
Detail Page display using Command:link Detail Page display using Command:link Reviewed by dasfrogpractice on 09:14 Rating: 5

2 comments:

Theme images by mariusFM77. Powered by Blogger.
Youtube Channel Image
Dasfrog Subscribe To watch more Salesforce Training
Subscribe