Display detail page using actionSupport in Visualforce Page

By | November 1, 2019

Hi, In this scenario we have shown how to display detail page of the record when we click on Name field in output. Here we 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 of the record.

Visualforce Page

<apex:page sidebar="false" standardController="Account" recordSetVar="rec">
  <apex:form >
       <apex:pageBlock >
          <apex:pageBlockSection >
              <apex:pageBlockTable value="{!rec}" var="r">
                  <apex:column headerValue="Name">
                    <apex:actionSupport event="onclick" rerender="out" status="status">
                      {!r.Name}
                      <apex:param name="rId" value="{!r.Id}"/>
                    </apex:actionSupport>
                  </apex:column>
                  <apex:column headerValue="Rating">
                      {!r.Rating}
                  </apex:column>
                  <apex:column headerValue="Industry">
                      {!r.Industry}
                  </apex:column>
                  <apex:column headerValue="phone">
                      {!r.Phone}
                  </apex:column>
          </apex:pageBlockTable>
      <apex:actionstatus id="status" 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:pageBlockSection>
      </apex:pageBlock>
  </apex:form>
</apex:page>

Output

Click on Name then detail page will be open

Share this...
Share on Facebook
Facebook
Email this to someone
email

Leave a Reply

Your email address will not be published.