Saturday, 28 September 2013

OutputPanel Usage In Visualforce Page

Salesforce has a provided with a very important tag ,apex:outputPanel. Recently I answered a question on stackoverflow that motivated me to write this small post.

The above link opens the documentation about this tag .This blogpost i have explored its exact use cases to use this tag

  1. Conditionally render a section of block of html element in a visualforce can be achieved with this tag as this tag has render attributes .

     2. A very interesting case is if the element is not rendered initially then on Re-rendering the panel nothing rerenders .The following blog below from Bob demonstrates on how to resolve this .Again the outpanel is the rescue

   3.A common requirement that comes sometimes is to align the command button to the center of the screen.The apex:pageblockButton can be used but in some cases we have buttons without pageblock and we get errors saying PageblockButtons can be direct parent


There are some interesting points to note in the above code .There is a layout attribute and i have made it block.Making it block we have a div element while making inline has a span element .You can clearly observe if i make layout as inline the above code wont make the button centered as the style will be inline for the span element.

Introducing Lightning Base Components

Lightning Base Components are great addition to the platform and in fact revolutionary .One of the concerns around lightning component ...