Showing posts with label dynamically loading. Show all posts
Showing posts with label dynamically loading. Show all posts

Dynamically loading related content without controller in visualforce

In visualforce usually for loading additional content based on user actions, we use ajax and custom controllers. But if you are targeting to load details tab of some records, it can be done without using custom controllers or extensions. Please check the sample code below,


As mentioned previously this method helps you to show additional content through ajax without using controller. In order to use it please follow below steps
  • Create a visualforce page with some name (example - samplePage) 
  • Copy above code into the page and save the page
  • Create one account and some contacts under it.
  • Pass the ID of the account to the custom page (instance.com/apex/samplePage?id=0019000000BzKjL)
  • It will show the account name and contacts under the account.
  • Hover over any contact, it will show the details of the contact below.
Here we are making use of $currentPage global merge fieldtype. General syntax is $CurrentPage.Parameters.parameterName