Tuesday, December 6, 2016

Visualforce - Beyond Basics Series 1 - Tabpanel SwitchType

tabpanel - switchtype

What is it ?

tabpanel tag facilitates tabbed view of the content. The content could be any container tag like div, span, iframe, etc. The 'Switchtype' attribute specifies how the content should be rendered. 
There are three possible ways to render the content,

  •   During Page Load
  •   When user switches the tab, through full page reload
  •   When user switches the tab, through partial page refresh(ajax call)

Why does it matter ?

I have seen most of the time, developers don't provide any value which defaults to server type. This will cause full page reload when user switches the tab. This is unnecessary in most cases & an expensive process.

What are the different scenarios to use ?

  • Use 'client' if the tab content is very small
  • Use 'server' if the tab content is large which will take more time to load during initial page load.
  • Use 'ajax' if user changes the tab very often & tabbed content is small proposition of the whole page. 

How to use it ?

This is the sample code illustrating with two tabs for each type. When you run this, you can see that 'client' type will take more time to load. 'server' type will refresh whole page when user changes the tab. 'ajax' type will simply refresh the tab content.







3 comments:

  1. Hii....
    I'm Prasanna. I am new to salesforce. I have completed my course recently in salesforce. Apart from Technical Architect there is no any other stuff like triggers,batchapex....

    ReplyDelete
  2. Hi Devi, Thanks for your comment. what course you have completed ? Are you asking me to put some posts on Triggers, batchApex etc ?

    ReplyDelete
  3. Can you please put some posts on Asynchronous Apex with examples

    ReplyDelete

Thanks for reading my blog !